Merge "DO NOT MERGE Ensure that the device is provisioned before showing Recents." into lmp-mr1-dev

This commit is contained in:
Winson Chung
2015-11-13 18:02:38 +00:00
committed by Android (Google) Code Review

View File

@@ -36,6 +36,7 @@ import android.graphics.Rect;
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.Pair; import android.util.Pair;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.View; import android.view.View;
@@ -239,6 +240,12 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
/** Shows the Recents. */ /** Shows the Recents. */
@ProxyFromPrimaryToCurrentUser @ProxyFromPrimaryToCurrentUser
public void onShowRecents(boolean triggeredFromAltTab) { public void onShowRecents(boolean triggeredFromAltTab) {
// Ensure the device has been provisioned before allowing the user to interact with
// recents
if (!isDeviceProvisioned()) {
return;
}
if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserOwner()) {
showRecents(triggeredFromAltTab); showRecents(triggeredFromAltTab);
} else { } else {
@@ -261,6 +268,12 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
/** Hides the Recents. */ /** Hides the Recents. */
@ProxyFromPrimaryToCurrentUser @ProxyFromPrimaryToCurrentUser
public void onHideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey) { public void onHideRecents(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()) {
hideRecents(triggeredFromAltTab, triggeredFromHomeKey); hideRecents(triggeredFromAltTab, triggeredFromHomeKey);
} else { } else {
@@ -287,6 +300,12 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
/** Toggles the Recents activity. */ /** Toggles the Recents activity. */
@ProxyFromPrimaryToCurrentUser @ProxyFromPrimaryToCurrentUser
public void onToggleRecents() { public void onToggleRecents() {
// Ensure the device has been provisioned before allowing the user to interact with
// recents
if (!isDeviceProvisioned()) {
return;
}
if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserOwner()) {
toggleRecents(); toggleRecents();
} else { } else {
@@ -308,6 +327,12 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
/** Preloads info for the Recents activity. */ /** Preloads info for the Recents activity. */
@ProxyFromPrimaryToCurrentUser @ProxyFromPrimaryToCurrentUser
public void onPreloadRecents() { public void onPreloadRecents() {
// Ensure the device has been provisioned before allowing the user to interact with
// recents
if (!isDeviceProvisioned()) {
return;
}
if (mSystemServicesProxy.isForegroundUserOwner()) { if (mSystemServicesProxy.isForegroundUserOwner()) {
preloadRecents(); preloadRecents();
} else { } else {
@@ -400,10 +425,22 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
} }
public void onShowNextAffiliatedTask() { public void onShowNextAffiliatedTask() {
// Ensure the device has been provisioned before allowing the user to interact with
// recents
if (!isDeviceProvisioned()) {
return;
}
showRelativeAffiliatedTask(true); showRelativeAffiliatedTask(true);
} }
public void onShowPrevAffiliatedTask() { public void onShowPrevAffiliatedTask() {
// Ensure the device has been provisioned before allowing the user to interact with
// recents
if (!isDeviceProvisioned()) {
return;
}
showRelativeAffiliatedTask(false); showRelativeAffiliatedTask(false);
} }
@@ -747,6 +784,14 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
return plan; return plan;
} }
/**
* @return whether this device is provisioned.
*/
private boolean isDeviceProvisioned() {
return Settings.Global.getInt(mContext.getContentResolver(),
Settings.Global.DEVICE_PROVISIONED, 0) != 0;
}
/**** OnAnimationStartedListener Implementation ****/ /**** OnAnimationStartedListener Implementation ****/
@Override @Override