summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--api/current.txt3
-rw-r--r--core/java/android/app/backup/BackupHelperDispatcher.java1
-rw-r--r--include/androidfw/BackupHelpers.h2
-rw-r--r--libs/androidfw/BackupHelpers.cpp79
-rw-r--r--packages/SystemUI/src/com/android/systemui/ImageWallpaper.java46
-rw-r--r--services/core/java/com/android/server/display/ColorFade.java6
-rw-r--r--telephony/java/android/telephony/SubscriptionInfo.java5
-rw-r--r--telephony/java/android/telephony/SubscriptionManager.java4
8 files changed, 61 insertions, 85 deletions
diff --git a/api/current.txt b/api/current.txt
index 96fccf7421c7..3e11cda0903c 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -28619,6 +28619,7 @@ package android.telephony {
method public int describeContents();
method public java.lang.CharSequence getCarrierName();
method public java.lang.String getCountryIso();
+ method public int getDataRoaming();
method public java.lang.CharSequence getDisplayName();
method public java.lang.String getIccId();
method public int getIconTint();
@@ -28641,6 +28642,8 @@ package android.telephony {
method public java.util.List<android.telephony.SubscriptionInfo> getActiveSubscriptionInfoList();
method public boolean isNetworkRoaming(int);
method public void removeOnSubscriptionsChangedListener(android.telephony.SubscriptionManager.OnSubscriptionsChangedListener);
+ field public static final int DATA_ROAMING_DISABLE = 0; // 0x0
+ field public static final int DATA_ROAMING_ENABLE = 1; // 0x1
}
public static class SubscriptionManager.OnSubscriptionsChangedListener {
diff --git a/core/java/android/app/backup/BackupHelperDispatcher.java b/core/java/android/app/backup/BackupHelperDispatcher.java
index 5466db561576..681153236967 100644
--- a/core/java/android/app/backup/BackupHelperDispatcher.java
+++ b/core/java/android/app/backup/BackupHelperDispatcher.java
@@ -50,7 +50,6 @@ public class BackupHelperDispatcher {
Header header = new Header();
TreeMap<String,BackupHelper> helpers = (TreeMap<String,BackupHelper>)mHelpers.clone();
FileDescriptor oldStateFD = null;
- FileDescriptor newStateFD = newState.getFileDescriptor();
if (oldState != null) {
oldStateFD = oldState.getFileDescriptor();
diff --git a/include/androidfw/BackupHelpers.h b/include/androidfw/BackupHelpers.h
index 1bb04a7123a3..0841af60faaa 100644
--- a/include/androidfw/BackupHelpers.h
+++ b/include/androidfw/BackupHelpers.h
@@ -152,7 +152,7 @@ private:
KeyedVector<String8,FileRec> m_files;
};
-#define TEST_BACKUP_HELPERS 1
+//#define TEST_BACKUP_HELPERS 1
#if TEST_BACKUP_HELPERS
int backup_helper_test_empty();
diff --git a/libs/androidfw/BackupHelpers.cpp b/libs/androidfw/BackupHelpers.cpp
index 52dce9f7f5c5..33cf8ef6f65c 100644
--- a/libs/androidfw/BackupHelpers.cpp
+++ b/libs/androidfw/BackupHelpers.cpp
@@ -225,8 +225,6 @@ write_update_file(BackupDataWriter* dataStream, int fd, int mode, const String8&
file_metadata_v1 metadata;
char* buf = (char*)malloc(bufsize);
- int crc = crc32(0L, Z_NULL, 0);
-
fileSize = lseek(fd, 0, SEEK_END);
lseek(fd, 0, SEEK_SET);
@@ -310,8 +308,12 @@ write_update_file(BackupDataWriter* dataStream, const String8& key, char const*
}
static int
-compute_crc32(int fd)
-{
+compute_crc32(const char* file, FileRec* out) {
+ int fd = open(file, O_RDONLY);
+ if (fd < 0) {
+ return -1;
+ }
+
const int bufsize = 4*1024;
int amt;
@@ -324,8 +326,11 @@ compute_crc32(int fd)
crc = crc32(crc, (Bytef*)buf, amt);
}
+ close(fd);
free(buf);
- return crc;
+
+ out->s.crc32 = crc;
+ return NO_ERROR;
}
int
@@ -353,7 +358,8 @@ back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD
err = stat(file, &st);
if (err != 0) {
- r.deleted = true;
+ // not found => treat as deleted
+ continue;
} else {
r.deleted = false;
r.s.modTime_sec = st.st_mtime;
@@ -361,12 +367,17 @@ back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD
//r.s.modTime_nsec = st.st_mtime_nsec;
r.s.mode = st.st_mode;
r.s.size = st.st_size;
- // we compute the crc32 later down below, when we already have the file open.
if (newSnapshot.indexOfKey(key) >= 0) {
LOGP("back_up_files key already in use '%s'", key.string());
return -1;
}
+
+ // compute the CRC
+ if (compute_crc32(file, &r) != NO_ERROR) {
+ ALOGW("Unable to open file %s", file);
+ continue;
+ }
}
newSnapshot.add(key, r);
}
@@ -374,49 +385,41 @@ back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD
int n = 0;
int N = oldSnapshot.size();
int m = 0;
+ int M = newSnapshot.size();
- while (n<N && m<fileCount) {
+ while (n<N && m<M) {
const String8& p = oldSnapshot.keyAt(n);
const String8& q = newSnapshot.keyAt(m);
FileRec& g = newSnapshot.editValueAt(m);
int cmp = p.compare(q);
- if (g.deleted || cmp < 0) {
- // file removed
+ if (cmp < 0) {
+ // file present in oldSnapshot, but not present in newSnapshot
LOGP("file removed: %s", p.string());
- g.deleted = true; // They didn't mention the file, but we noticed that it's gone.
- dataStream->WriteEntityHeader(p, -1);
+ write_delete_file(dataStream, p);
n++;
- }
- else if (cmp > 0) {
+ } else if (cmp > 0) {
// file added
- LOGP("file added: %s", g.file.string());
+ LOGP("file added: %s crc=0x%08x", g.file.string(), g.s.crc32);
write_update_file(dataStream, q, g.file.string());
m++;
- }
- else {
- // both files exist, check them
+ } else {
+ // same file exists in both old and new; check whether to update
const FileState& f = oldSnapshot.valueAt(n);
- int fd = open(g.file.string(), O_RDONLY);
- if (fd < 0) {
- // We can't open the file. Don't report it as a delete either. Let the
- // server keep the old version. Maybe they'll be able to deal with it
- // on restore.
- LOGP("Unable to open file %s - skipping", g.file.string());
- } else {
- g.s.crc32 = compute_crc32(fd);
-
- LOGP("%s", q.string());
- LOGP(" new: modTime=%d,%d mode=%04o size=%-3d crc32=0x%08x",
- f.modTime_sec, f.modTime_nsec, f.mode, f.size, f.crc32);
- LOGP(" old: modTime=%d,%d mode=%04o size=%-3d crc32=0x%08x",
- g.s.modTime_sec, g.s.modTime_nsec, g.s.mode, g.s.size, g.s.crc32);
- if (f.modTime_sec != g.s.modTime_sec || f.modTime_nsec != g.s.modTime_nsec
- || f.mode != g.s.mode || f.size != g.s.size || f.crc32 != g.s.crc32) {
+ LOGP("%s", q.string());
+ LOGP(" old: modTime=%d,%d mode=%04o size=%-3d crc32=0x%08x",
+ f.modTime_sec, f.modTime_nsec, f.mode, f.size, f.crc32);
+ LOGP(" new: modTime=%d,%d mode=%04o size=%-3d crc32=0x%08x",
+ g.s.modTime_sec, g.s.modTime_nsec, g.s.mode, g.s.size, g.s.crc32);
+ if (f.modTime_sec != g.s.modTime_sec || f.modTime_nsec != g.s.modTime_nsec
+ || f.mode != g.s.mode || f.size != g.s.size || f.crc32 != g.s.crc32) {
+ int fd = open(g.file.string(), O_RDONLY);
+ if (fd < 0) {
+ ALOGE("Unable to read file for backup: %s", g.file.string());
+ } else {
write_update_file(dataStream, fd, g.s.mode, p, g.file.string());
+ close(fd);
}
-
- close(fd);
}
n++;
m++;
@@ -425,12 +428,12 @@ back_up_files(int oldSnapshotFD, BackupDataWriter* dataStream, int newSnapshotFD
// these were deleted
while (n<N) {
- dataStream->WriteEntityHeader(oldSnapshot.keyAt(n), -1);
+ write_delete_file(dataStream, oldSnapshot.keyAt(n));
n++;
}
// these were added
- while (m<fileCount) {
+ while (m<M) {
const String8& q = newSnapshot.keyAt(m);
FileRec& g = newSnapshot.editValueAt(m);
write_update_file(dataStream, q, g.file.string());
diff --git a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
index 0516768d2d9f..7c725b32c5ce 100644
--- a/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
+++ b/packages/SystemUI/src/com/android/systemui/ImageWallpaper.java
@@ -105,10 +105,6 @@ public class ImageWallpaper extends WallpaperService {
static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098;
static final int EGL_OPENGL_ES2_BIT = 4;
- // TODO: Not currently used, keeping around until we know we don't need it
- @SuppressWarnings({"UnusedDeclaration"})
- private WallpaperObserver mReceiver;
-
Bitmap mBackground;
int mBackgroundWidth = -1, mBackgroundHeight = -1;
int mLastSurfaceWidth = -1, mLastSurfaceHeight = -1;
@@ -151,22 +147,6 @@ public class ImageWallpaper extends WallpaperService {
private static final int TRIANGLE_VERTICES_DATA_POS_OFFSET = 0;
private static final int TRIANGLE_VERTICES_DATA_UV_OFFSET = 3;
- class WallpaperObserver extends BroadcastReceiver {
- @Override
- public void onReceive(Context context, Intent intent) {
- if (DEBUG) {
- Log.d(TAG, "onReceive");
- }
-
- mLastSurfaceWidth = mLastSurfaceHeight = -1;
- mBackground = null;
- mBackgroundWidth = -1;
- mBackgroundHeight = -1;
- mRedrawNeeded = true;
- drawFrame();
- }
- }
-
public DrawableEngine() {
super();
setFixedSizeAllowed(true);
@@ -194,12 +174,6 @@ public class ImageWallpaper extends WallpaperService {
super.onCreate(surfaceHolder);
- // TODO: Don't need this currently because the wallpaper service
- // will restart the image wallpaper whenever the image changes.
- //IntentFilter filter = new IntentFilter(Intent.ACTION_WALLPAPER_CHANGED);
- //mReceiver = new WallpaperObserver();
- //registerReceiver(mReceiver, filter, null, mHandler);
-
updateSurfaceSize(surfaceHolder);
setOffsetNotificationsEnabled(false);
@@ -208,9 +182,6 @@ public class ImageWallpaper extends WallpaperService {
@Override
public void onDestroy() {
super.onDestroy();
- if (mReceiver != null) {
- unregisterReceiver(mReceiver);
- }
mBackground = null;
mWallpaperManager.forgetLoadedWallpaper();
}
@@ -562,7 +533,7 @@ public class ImageWallpaper extends WallpaperService {
boolean status = mEgl.eglSwapBuffers(mEglDisplay, mEglSurface);
checkEglError();
- finishGL();
+ finishGL(texture, program);
return status;
}
@@ -615,21 +586,18 @@ public class ImageWallpaper extends WallpaperService {
int program = glCreateProgram();
glAttachShader(program, vertexShader);
- checkGlError();
-
glAttachShader(program, fragmentShader);
- checkGlError();
-
glLinkProgram(program);
checkGlError();
+ glDeleteShader(vertexShader);
+ glDeleteShader(fragmentShader);
+
int[] status = new int[1];
glGetProgramiv(program, GL_LINK_STATUS, status, 0);
if (status[0] != GL_TRUE) {
String error = glGetProgramInfoLog(program);
Log.d(GL_LOG_TAG, "Error while linking program:\n" + error);
- glDeleteShader(vertexShader);
- glDeleteShader(fragmentShader);
glDeleteProgram(program);
return 0;
}
@@ -672,7 +640,11 @@ public class ImageWallpaper extends WallpaperService {
}
}
- private void finishGL() {
+ private void finishGL(int texture, int program) {
+ int[] textures = new int[1];
+ textures[0] = texture;
+ glDeleteTextures(1, textures, 0);
+ glDeleteProgram(program);
mEgl.eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT);
mEgl.eglDestroySurface(mEglDisplay, mEglSurface);
mEgl.eglDestroyContext(mEglDisplay, mEglContext);
diff --git a/services/core/java/com/android/server/display/ColorFade.java b/services/core/java/com/android/server/display/ColorFade.java
index f549f3d3fd2b..6e61e41ade09 100644
--- a/services/core/java/com/android/server/display/ColorFade.java
+++ b/services/core/java/com/android/server/display/ColorFade.java
@@ -464,13 +464,13 @@ final class ColorFade {
try {
SurfaceControl.screenshot(SurfaceControl.getBuiltInDisplay(
SurfaceControl.BUILT_IN_DISPLAY_ID_MAIN), s);
+ st.updateTexImage();
+ st.getTransformMatrix(mTexMatrix);
} finally {
s.release();
+ st.release();
}
- st.updateTexImage();
- st.getTransformMatrix(mTexMatrix);
-
// Set up texture coordinates for a quad.
// We might need to change this if the texture ends up being
// a different size from the display for some reason.
diff --git a/telephony/java/android/telephony/SubscriptionInfo.java b/telephony/java/android/telephony/SubscriptionInfo.java
index f3b69103f9b6..adbe1d8453ca 100644
--- a/telephony/java/android/telephony/SubscriptionInfo.java
+++ b/telephony/java/android/telephony/SubscriptionInfo.java
@@ -254,9 +254,8 @@ public class SubscriptionInfo implements Parcelable {
}
/**
- * @return the data roaming state for this subscription, either DATA_ROAMING_ENABLE or
- * DATA_ROAMING_DISABLE.
- * @hide
+ * @return the data roaming state for this subscription, either
+ * {@link SubscriptionManager#DATA_ROAMING_ENABLE} or {@link SubscriptionManager#DATA_ROAMING_DISABLE}.
*/
public int getDataRoaming() {
return this.mDataRoaming;
diff --git a/telephony/java/android/telephony/SubscriptionManager.java b/telephony/java/android/telephony/SubscriptionManager.java
index 9ef6f1f9dd96..c67629d19316 100644
--- a/telephony/java/android/telephony/SubscriptionManager.java
+++ b/telephony/java/android/telephony/SubscriptionManager.java
@@ -226,10 +226,10 @@ public class SubscriptionManager {
/** @hide */
public static final String DATA_ROAMING = "data_roaming";
- /** @hide */
+ /** Indicates that data roaming is enabled for a subscription */
public static final int DATA_ROAMING_ENABLE = 1;
- /** @hide */
+ /** Indicates that data roaming is disabled for a subscription */
public static final int DATA_ROAMING_DISABLE = 0;
/** @hide */