Merge "v3 keys use SP800 derivation" into pi-dev
diff --git a/core/java/android/view/ViewRootImpl.java b/core/java/android/view/ViewRootImpl.java
index 6df0173..a1c0967 100644
--- a/core/java/android/view/ViewRootImpl.java
+++ b/core/java/android/view/ViewRootImpl.java
@@ -1354,6 +1354,9 @@
}
if (mStopped) {
+ if (mSurfaceHolder != null) {
+ notifySurfaceDestroyed();
+ }
mSurface.release();
}
}
@@ -2227,13 +2230,7 @@
}
mIsCreating = false;
} else if (hadSurface) {
- mSurfaceHolder.ungetCallbacks();
- SurfaceHolder.Callback callbacks[] = mSurfaceHolder.getCallbacks();
- if (callbacks != null) {
- for (SurfaceHolder.Callback c : callbacks) {
- c.surfaceDestroyed(mSurfaceHolder);
- }
- }
+ notifySurfaceDestroyed();
mSurfaceHolder.mSurfaceLock.lock();
try {
mSurfaceHolder.mSurface = new Surface();
@@ -2497,6 +2494,16 @@
mIsInTraversal = false;
}
+ private void notifySurfaceDestroyed() {
+ mSurfaceHolder.ungetCallbacks();
+ SurfaceHolder.Callback[] callbacks = mSurfaceHolder.getCallbacks();
+ if (callbacks != null) {
+ for (SurfaceHolder.Callback c : callbacks) {
+ c.surfaceDestroyed(mSurfaceHolder);
+ }
+ }
+ }
+
private void maybeHandleWindowMove(Rect frame) {
// TODO: Well, we are checking whether the frame has changed similarly
diff --git a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
index 7339304..f495ced 100644
--- a/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
+++ b/packages/SystemUI/src/com/android/systemui/doze/DozeService.java
@@ -38,6 +38,7 @@
private DozeMachine mDozeMachine;
private DozeServicePlugin mDozePlugin;
+ private PluginManager mPluginManager;
public DozeService() {
setDebug(DEBUG);
@@ -53,14 +54,14 @@
finish();
return;
}
- Dependency.get(PluginManager.class).addPluginListener(this,
- DozeServicePlugin.class, false /* Allow multiple */);
+ mPluginManager = Dependency.get(PluginManager.class);
+ mPluginManager.addPluginListener(this, DozeServicePlugin.class, false /* allowMultiple */);
mDozeMachine = new DozeFactory().assembleMachine(this);
}
@Override
public void onDestroy() {
- Dependency.get(PluginManager.class).removePluginListener(this);
+ mPluginManager.removePluginListener(this);
super.onDestroy();
mDozeMachine = null;
}
diff --git a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
index 547ab0e..0d00041 100644
--- a/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
+++ b/services/core/java/com/android/server/wallpaper/WallpaperManagerService.java
@@ -541,6 +541,7 @@
*/
private void extractColors(WallpaperData wallpaper) {
String cropFile = null;
+ boolean defaultImageWallpaper = false;
int wallpaperId;
synchronized (mLock) {
@@ -549,6 +550,8 @@
|| wallpaper.wallpaperComponent == null;
if (imageWallpaper && wallpaper.cropFile != null && wallpaper.cropFile.exists()) {
cropFile = wallpaper.cropFile.getAbsolutePath();
+ } else if (imageWallpaper && !wallpaper.cropExists() && !wallpaper.sourceExists()) {
+ defaultImageWallpaper = true;
}
wallpaperId = wallpaper.wallpaperId;
}
@@ -560,6 +563,25 @@
colors = WallpaperColors.fromBitmap(bitmap);
bitmap.recycle();
}
+ } else if (defaultImageWallpaper) {
+ // There is no crop and source file because this is default image wallpaper.
+ try (final InputStream is =
+ WallpaperManager.openDefaultWallpaper(mContext, FLAG_SYSTEM)) {
+ if (is != null) {
+ try {
+ final BitmapFactory.Options options = new BitmapFactory.Options();
+ final Bitmap bitmap = BitmapFactory.decodeStream(is, null, options);
+ if (bitmap != null) {
+ colors = WallpaperColors.fromBitmap(bitmap);
+ bitmap.recycle();
+ }
+ } catch (OutOfMemoryError e) {
+ Slog.w(TAG, "Can't decode default wallpaper stream", e);
+ }
+ }
+ } catch (IOException e) {
+ Slog.w(TAG, "Can't close default wallpaper stream", e);
+ }
}
if (colors == null) {
diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java
index c574fb4..e7361ef 100644
--- a/telephony/java/android/telephony/TelephonyManager.java
+++ b/telephony/java/android/telephony/TelephonyManager.java
@@ -7581,6 +7581,9 @@
@SystemApi
@RequiresPermission(android.Manifest.permission.MODIFY_PHONE_STATE)
public int setAllowedCarriers(int slotIndex, List<CarrierIdentifier> carriers) {
+ if (!SubscriptionManager.isValidPhoneId(slotIndex)) {
+ return -1;
+ }
try {
ITelephony service = getITelephony();
if (service != null) {
@@ -7608,15 +7611,17 @@
@SystemApi
@RequiresPermission(android.Manifest.permission.READ_PRIVILEGED_PHONE_STATE)
public List<CarrierIdentifier> getAllowedCarriers(int slotIndex) {
- try {
- ITelephony service = getITelephony();
- if (service != null) {
- return service.getAllowedCarriers(slotIndex);
+ if (SubscriptionManager.isValidPhoneId(slotIndex)) {
+ try {
+ ITelephony service = getITelephony();
+ if (service != null) {
+ return service.getAllowedCarriers(slotIndex);
+ }
+ } catch (RemoteException e) {
+ Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
+ } catch (NullPointerException e) {
+ Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
}
- } catch (RemoteException e) {
- Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
- } catch (NullPointerException e) {
- Log.e(TAG, "Error calling ITelephony#getAllowedCarriers", e);
}
return new ArrayList<CarrierIdentifier>(0);
}