summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-11-13 18:02:47 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-11-13 18:02:47 +0000
commitdce0f8040dcce494166832eb6c1e8a2d9638ddd4 (patch)
treeca0271072a65c345cb1c4d5442a2f53b518da86a
parentc9eb8b436715ba9b59382759cf0dcf991ed33594 (diff)
parenta7df77155dced518d4dc81f5a87f6aa51ce7432c (diff)
downloadframeworks_base-dce0f8040dcce494166832eb6c1e8a2d9638ddd4.zip
frameworks_base-dce0f8040dcce494166832eb6c1e8a2d9638ddd4.tar.gz
frameworks_base-dce0f8040dcce494166832eb6c1e8a2d9638ddd4.tar.bz2
Merge "DO NOT MERGE Ensure that the device is provisioned before showing Recents." into mnc-dev
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Recents.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
index 8c2ac88..3bcbd65 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -35,6 +35,7 @@ import android.os.AsyncTask;
import android.os.Handler;
import android.os.SystemClock;
import android.os.UserHandle;
+import android.provider.Settings;
import android.util.MutableBoolean;
import android.view.Display;
import android.view.LayoutInflater;
@@ -281,6 +282,12 @@ public class Recents extends SystemUI
@ProxyFromPrimaryToCurrentUser
@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 (mSystemServicesProxy.isForegroundUserOwner()) {
showRecentsInternal(triggeredFromAltTab);
} else {
@@ -305,6 +312,12 @@ public class Recents extends SystemUI
@ProxyFromPrimaryToCurrentUser
@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 (mSystemServicesProxy.isForegroundUserOwner()) {
hideRecentsInternal(triggeredFromAltTab, triggeredFromHomeKey);
} else {
@@ -331,6 +344,12 @@ public class Recents extends SystemUI
@ProxyFromPrimaryToCurrentUser
@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 (mSystemServicesProxy.isForegroundUserOwner()) {
toggleRecentsInternal();
} else {
@@ -354,6 +373,12 @@ public class Recents extends SystemUI
@ProxyFromPrimaryToCurrentUser
@Override
public void preloadRecents() {
+ // Ensure the device has been provisioned before allowing the user to interact with
+ // recents
+ if (!isDeviceProvisioned()) {
+ return;
+ }
+
if (mSystemServicesProxy.isForegroundUserOwner()) {
preloadRecentsInternal();
} else {
@@ -470,6 +495,12 @@ 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;
+ }
+
// Keep track of when the affiliated task is triggered
MetricsLogger.count(mContext, "overview_affiliated_task_next", 1);
showRelativeAffiliatedTask(true);
@@ -477,6 +508,12 @@ public class Recents extends SystemUI
@Override
public void showPrevAffiliatedTask() {
+ // Ensure the device has been provisioned before allowing the user to interact with
+ // recents
+ if (!isDeviceProvisioned()) {
+ return;
+ }
+
// Keep track of when the affiliated task is triggered
MetricsLogger.count(mContext, "overview_affiliated_task_prev", 1);
showRelativeAffiliatedTask(false);
@@ -889,6 +926,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;
+ }
+
+ /**
* Returns the preloaded load plan and invalidates it.
*/
public static RecentsTaskLoadPlan consumeInstanceLoadPlan() {