Merge "DO NOT MERGE Ensure that the device is provisioned before showing Recents." into mnc-dev am: dce0f8040d am: 3e9f2b7894 am: 1b29fd87a2

am: 3bab0fd4f7

* commit '3bab0fd4f7b848d45ce94b96abbdc537d1e47a5a':
  DO NOT MERGE Ensure that the device is provisioned before showing Recents.
This commit is contained in:
Winson Chung
2015-11-13 18:29:35 +00:00
committed by android-build-merger

View File

@@ -34,6 +34,7 @@ import android.os.AsyncTask;
import android.os.Handler; import android.os.Handler;
import android.os.SystemClock; import android.os.SystemClock;
import android.os.UserHandle; import android.os.UserHandle;
import android.provider.Settings;
import android.util.MutableBoolean; import android.util.MutableBoolean;
import android.view.Display; import android.view.Display;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@@ -280,6 +281,12 @@ public class Recents extends SystemUI
@ProxyFromPrimaryToCurrentUser @ProxyFromPrimaryToCurrentUser
@Override @Override
public void showRecents(boolean triggeredFromAltTab, View statusBarView) { 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()) { if (mSystemServicesProxy.isForegroundUserOwner()) {
showRecentsInternal(triggeredFromAltTab); showRecentsInternal(triggeredFromAltTab);
} else { } else {
@@ -304,6 +311,12 @@ public class Recents extends SystemUI
@ProxyFromPrimaryToCurrentUser @ProxyFromPrimaryToCurrentUser
@Override @Override
public void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { 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()) { if (mSystemServicesProxy.isForegroundUserOwner()) {
hideRecentsInternal(triggeredFromAltTab, triggeredFromHomeKey); hideRecentsInternal(triggeredFromAltTab, triggeredFromHomeKey);
} else { } else {
@@ -330,6 +343,12 @@ public class Recents extends SystemUI
@ProxyFromPrimaryToCurrentUser @ProxyFromPrimaryToCurrentUser
@Override @Override
public void toggleRecents(Display display, int layoutDirection, View statusBarView) { 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()) { if (mSystemServicesProxy.isForegroundUserOwner()) {
toggleRecentsInternal(); toggleRecentsInternal();
} else { } else {
@@ -353,6 +372,12 @@ public class Recents extends SystemUI
@ProxyFromPrimaryToCurrentUser @ProxyFromPrimaryToCurrentUser
@Override @Override
public void preloadRecents() { public void preloadRecents() {
// Ensure the device has been provisioned before allowing the user to interact with
// recents
if (!isDeviceProvisioned()) {
return;
}
if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserOwner()) {
preloadRecentsInternal(); preloadRecentsInternal();
} else { } else {
@@ -469,6 +494,12 @@ public class Recents extends SystemUI
@Override @Override
public void showNextAffiliatedTask() { 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 // Keep track of when the affiliated task is triggered
MetricsLogger.count(mContext, "overview_affiliated_task_next", 1); MetricsLogger.count(mContext, "overview_affiliated_task_next", 1);
showRelativeAffiliatedTask(true); showRelativeAffiliatedTask(true);
@@ -476,6 +507,12 @@ public class Recents extends SystemUI
@Override @Override
public void showPrevAffiliatedTask() { 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 // Keep track of when the affiliated task is triggered
MetricsLogger.count(mContext, "overview_affiliated_task_prev", 1); MetricsLogger.count(mContext, "overview_affiliated_task_prev", 1);
showRelativeAffiliatedTask(false); showRelativeAffiliatedTask(false);
@@ -887,6 +924,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. * Returns the preloaded load plan and invalidates it.
*/ */