From e924356ddf8d7e84306d0ee6a63dc6ed6f8b6675 Mon Sep 17 00:00:00 2001 From: Winson Date: Tue, 10 Nov 2015 16:07:13 -0800 Subject: [PATCH] Ensure that the device is provisioned before showing Recents. Bug: 25476219 Change-Id: I87b78d4c3ca1e4d71280f057f3e076cc456bbf8f --- .../src/com/android/systemui/recents/Recents.java | 51 ++++++++++++++++++++++ 1 file changed, 51 insertions(+) diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index a58bc5882f2a..9dac46977cb2 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -27,6 +27,7 @@ import android.os.IBinder; import android.os.RemoteException; import android.os.SystemProperties; import android.os.UserHandle; +import android.provider.Settings; import android.util.Log; import android.view.Display; import android.view.View; @@ -193,6 +194,12 @@ public class Recents extends SystemUI */ @Override public void showRecents(boolean triggeredFromAltTab, View statusBarView) { + // Ensure the device has been provisioned before allowing the user to interact with + // recents + if (!isDeviceProvisioned()) { + return; + } + if (proxyToOverridePackage(ACTION_SHOW_RECENTS)) { return; } @@ -222,6 +229,12 @@ public class Recents extends SystemUI */ @Override public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { + // Ensure the device has been provisioned before allowing the user to interact with + // recents + if (!isDeviceProvisioned()) { + return; + } + if (proxyToOverridePackage(ACTION_HIDE_RECENTS)) { return; } @@ -251,6 +264,12 @@ public class Recents extends SystemUI */ @Override public void toggleRecents(Display display, int layoutDirection, View statusBarView) { + // Ensure the device has been provisioned before allowing the user to interact with + // recents + if (!isDeviceProvisioned()) { + return; + } + if (proxyToOverridePackage(ACTION_TOGGLE_RECENTS)) { return; } @@ -280,6 +299,12 @@ public class Recents extends SystemUI */ @Override public void preloadRecents() { + // Ensure the device has been provisioned before allowing the user to interact with + // recents + if (!isDeviceProvisioned()) { + return; + } + int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.preloadRecents(); @@ -302,6 +327,12 @@ public class Recents extends SystemUI @Override public void cancelPreloadingRecents() { + // Ensure the device has been provisioned before allowing the user to interact with + // recents + if (!isDeviceProvisioned()) { + return; + } + int currentUser = sSystemServicesProxy.getCurrentUser(); if (sSystemServicesProxy.isSystemUser(currentUser)) { mImpl.cancelPreloadingRecents(); @@ -329,11 +360,23 @@ public class Recents extends SystemUI @Override public void showNextAffiliatedTask() { + // Ensure the device has been provisioned before allowing the user to interact with + // recents + if (!isDeviceProvisioned()) { + return; + } + mImpl.showNextAffiliatedTask(); } @Override public void showPrevAffiliatedTask() { + // Ensure the device has been provisioned before allowing the user to interact with + // recents + if (!isDeviceProvisioned()) { + return; + } + mImpl.showPrevAffiliatedTask(); } @@ -456,6 +499,14 @@ public class Recents extends SystemUI } /** + * @return whether this device is provisioned. + */ + private boolean isDeviceProvisioned() { + return Settings.Global.getInt(mContext.getContentResolver(), + Settings.Global.DEVICE_PROVISIONED, 0) != 0; + } + + /** * Attempts to proxy the following action to the override recents package. * @return whether the proxying was successful */ -- 2.11.0