diff options
7 files changed, 81 insertions, 19 deletions
diff --git a/core/java/android/view/ViewGroup.java b/core/java/android/view/ViewGroup.java index fab81a4..52d6cbe 100644 --- a/core/java/android/view/ViewGroup.java +++ b/core/java/android/view/ViewGroup.java @@ -43,6 +43,7 @@ import android.util.AttributeSet; import android.util.Log; import android.util.Pools.SynchronizedPool; import android.util.SparseArray; +import android.util.SparseBooleanArray; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityNodeInfo; import android.view.animation.Animation; @@ -2902,13 +2903,58 @@ public abstract class ViewGroup extends View implements ViewParent, ViewManager final int childrenCount = getChildCount(); if (childrenCount > 0) { structure.setChildCount(childrenCount); - final ArrayList<View> preorderedList = buildOrderedChildList(); - final boolean customOrder = preorderedList == null + ArrayList<View> preorderedList = buildOrderedChildList(); + boolean customOrder = preorderedList == null && isChildrenDrawingOrderEnabled(); final View[] children = mChildren; for (int i=0; i<childrenCount; i++) { - final int childIndex = customOrder - ? getChildDrawingOrder(childrenCount, i) : i; + int childIndex; + try { + childIndex = customOrder ? getChildDrawingOrder(childrenCount, i) : i; + } catch (IndexOutOfBoundsException e) { + childIndex = i; + if (mContext.getApplicationInfo().targetSdkVersion + < Build.VERSION_CODES.M) { + Log.w(TAG, "Bad getChildDrawingOrder while collecting assist @ " + + i + " of " + childrenCount, e); + // At least one app is failing when we call getChildDrawingOrder + // at this point, so deal semi-gracefully with it by falling back + // on the basic order. + customOrder = false; + if (i > 0) { + // If we failed at the first index, there really isn't + // anything to do -- we will just proceed with the simple + // sequence order. + // Otherwise, we failed in the middle, so need to come up + // with an order for the remaining indices and use that. + // Failed at the first one, easy peasy. + int[] permutation = new int[childrenCount]; + SparseBooleanArray usedIndices = new SparseBooleanArray(); + // Go back and collected the indices we have done so far. + for (int j=0; j<i; j++) { + permutation[j] = getChildDrawingOrder(childrenCount, j); + usedIndices.put(permutation[j], true); + } + // Fill in the remaining indices with indices that have not + // yet been used. + int nextIndex = 0; + for (int j=i; j<childrenCount; j++) { + while (usedIndices.get(nextIndex, false)) { + nextIndex++; + } + permutation[j] = nextIndex; + nextIndex++; + } + // Build the final view list. + preorderedList = new ArrayList<>(childrenCount); + for (int j=0; j<childrenCount; j++) { + preorderedList.add(children[permutation[j]]); + } + } + } else { + throw e; + } + } final View child = (preorderedList == null) ? children[childIndex] : preorderedList.get(childIndex); ViewStructure cstructure = structure.newChild(i); diff --git a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java index d99f741..e74334b 100644 --- a/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java +++ b/packages/SettingsProvider/src/com/android/providers/settings/SettingsBackupAgent.java @@ -447,8 +447,10 @@ public class SettingsBackupAgent extends BackupAgentHelper { Settings.Global.putInt(cr, Settings.Global.WIFI_SCAN_ALWAYS_AVAILABLE, 0); } - // !!! Give the wifi stack a moment to quiesce - try { Thread.sleep(1500); } catch (InterruptedException e) {} + // !!! Give the wifi stack a moment to quiesce. We've observed the + // response to disabling WIFI_SCAN_ALWAYS_AVAILABLE taking more + // than 1500ms, so we wait a generous 2500 here before proceeding. + try { Thread.sleep(2500); } catch (InterruptedException e) {} if (restoredSupplicantData != null) { restoreWifiSupplicant(FILE_WIFI_SUPPLICANT, restoredSupplicantData, restoredSupplicantData.length); diff --git a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java index 9f86a52..c1df788 100644 --- a/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java +++ b/packages/SystemUI/src/com/android/systemui/keyguard/KeyguardViewMediator.java @@ -841,11 +841,6 @@ public class KeyguardViewMediator extends SystemUI { synchronized (this) { if (DEBUG) Log.d(TAG, "setKeyguardEnabled(" + enabled + ")"); - if (isSecure()) { - Log.d(TAG, "current mode is SecurityMode, ignore hide keyguard"); - return; - } - mExternallyEnabled = enabled; if (!enabled && mShowing) { diff --git a/services/core/java/com/android/server/MountService.java b/services/core/java/com/android/server/MountService.java index 53e8d14..d10a457 100644 --- a/services/core/java/com/android/server/MountService.java +++ b/services/core/java/com/android/server/MountService.java @@ -766,6 +766,15 @@ class MountService extends IMountService.Stub } } + private void addInternalVolume() { + // Create a stub volume that represents internal storage + final VolumeInfo internal = new VolumeInfo(VolumeInfo.ID_PRIVATE_INTERNAL, + VolumeInfo.TYPE_PRIVATE, null, null); + internal.state = VolumeInfo.STATE_MOUNTED; + internal.path = Environment.getDataDirectory().getAbsolutePath(); + mVolumes.put(internal.id, internal); + } + private void resetIfReadyAndConnectedLocked() { Slog.d(TAG, "Thinking about reset, mSystemReady=" + mSystemReady + ", mDaemonConnected=" + mDaemonConnected); @@ -775,12 +784,7 @@ class MountService extends IMountService.Stub mDisks.clear(); mVolumes.clear(); - // Create a stub volume that represents internal storage - final VolumeInfo internal = new VolumeInfo(VolumeInfo.ID_PRIVATE_INTERNAL, - VolumeInfo.TYPE_PRIVATE, null, null); - internal.state = VolumeInfo.STATE_MOUNTED; - internal.path = Environment.getDataDirectory().getAbsolutePath(); - mVolumes.put(internal.id, internal); + addInternalVolume(); try { mConnector.execute("volume", "reset"); @@ -1412,6 +1416,8 @@ class MountService extends IMountService.Stub userFilter.addAction(Intent.ACTION_USER_REMOVED); mContext.registerReceiver(mUserReceiver, userFilter, null, mHandler); + addInternalVolume(); + // Add ourself to the Watchdog monitors if enabled. if (WATCHDOG_ENABLE) { Watchdog.getInstance().addMonitor(this); diff --git a/services/core/java/com/android/server/am/ActivityStackSupervisor.java b/services/core/java/com/android/server/am/ActivityStackSupervisor.java index 71fd49b..7c79661 100644 --- a/services/core/java/com/android/server/am/ActivityStackSupervisor.java +++ b/services/core/java/com/android/server/am/ActivityStackSupervisor.java @@ -1509,9 +1509,13 @@ public final class ActivityStackSupervisor implements DisplayListener { intent.addCategory(Intent.CATEGORY_VOICE); if (!AppGlobals.getPackageManager().activitySupportsIntent( intent.getComponent(), intent, resolvedType)) { + Slog.w(TAG, + "Activity being started in current voice task does not support voice: " + + intent); err = ActivityManager.START_NOT_VOICE_COMPATIBLE; } } catch (RemoteException e) { + Slog.w(TAG, "Failure checking voice capabilities", e); err = ActivityManager.START_NOT_VOICE_COMPATIBLE; } } @@ -1523,9 +1527,13 @@ public final class ActivityStackSupervisor implements DisplayListener { try { if (!AppGlobals.getPackageManager().activitySupportsIntent(intent.getComponent(), intent, resolvedType)) { + Slog.w(TAG, + "Activity being started in new voice task does not support: " + + intent); err = ActivityManager.START_NOT_VOICE_COMPATIBLE; } } catch (RemoteException e) { + Slog.w(TAG, "Failure checking voice capabilities", e); err = ActivityManager.START_NOT_VOICE_COMPATIBLE; } } diff --git a/services/core/java/com/android/server/pm/UserManagerService.java b/services/core/java/com/android/server/pm/UserManagerService.java index ebcbecd..264170c 100644 --- a/services/core/java/com/android/server/pm/UserManagerService.java +++ b/services/core/java/com/android/server/pm/UserManagerService.java @@ -246,7 +246,7 @@ public class UserManagerService extends IUserManager.Stub { } for (int i = 0; i < partials.size(); i++) { UserInfo ui = partials.get(i); - Slog.w(LOG_TAG, "Removing partially created user #" + i + Slog.w(LOG_TAG, "Removing partially created user " + ui.id + " (name=" + ui.name + ")"); removeUserStateLocked(ui.id); } diff --git a/services/core/java/com/android/server/wm/WindowManagerService.java b/services/core/java/com/android/server/wm/WindowManagerService.java index 26e75bd..bc5ef36 100644 --- a/services/core/java/com/android/server/wm/WindowManagerService.java +++ b/services/core/java/com/android/server/wm/WindowManagerService.java @@ -155,7 +155,6 @@ import static android.view.WindowManager.LayoutParams.FIRST_APPLICATION_WINDOW; import static android.view.WindowManager.LayoutParams.FIRST_SUB_WINDOW; import static android.view.WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM; import static android.view.WindowManager.LayoutParams.FLAG_DIM_BEHIND; -import static android.view.WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS; import static android.view.WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON; import static android.view.WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE; import static android.view.WindowManager.LayoutParams.FLAG_SECURE; @@ -5367,6 +5366,12 @@ public class WindowManagerService extends IWindowManager.Stub != PackageManager.PERMISSION_GRANTED) { throw new SecurityException("Requires DISABLE_KEYGUARD permission"); } + // If this isn't coming from the system then don't allow disabling the lockscreen + // to bypass security. + if (Binder.getCallingUid() != Process.SYSTEM_UID && isKeyguardSecure()) { + Log.d(TAG, "current mode is SecurityMode, ignore hide keyguard"); + return; + } if (token == null) { throw new IllegalArgumentException("token == null"); |
