summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android
diff options
context:
space:
mode:
authorJason Monk <jmonk@google.com>2014-07-18 10:29:14 -0400
committerWinson Chung <winsonc@google.com>2014-07-18 16:45:34 -0700
commit56e09b42a0f1670970872bef611a8036904ad6bf (patch)
tree2591c6d76ed48179b5fa87288ad40e09697972fe /packages/SystemUI/src/com/android
parent5598216931f7f5d42b7c062fdeb20b11ef853df8 (diff)
downloadframeworks_base-56e09b42a0f1670970872bef611a8036904ad6bf.zip
frameworks_base-56e09b42a0f1670970872bef611a8036904ad6bf.tar.gz
frameworks_base-56e09b42a0f1670970872bef611a8036904ad6bf.tar.bz2
Add setting to guard the lock-to-app recents icon
Lock-to-app (soon to be screen-pinning) will now only show up once it has been enabled in settings. Bug: 16378448 Change-Id: Ide333463f86310eacb7a1d8b6dc7b1aea8722713
Diffstat (limited to 'packages/SystemUI/src/com/android')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java6
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java21
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java18
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/Task.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java4
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java24
9 files changed, 68 insertions, 34 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index b6d7d7e..66e5d14 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -84,7 +84,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
mContext = context;
mSystemServicesProxy = new SystemServicesProxy(context);
mHandler = new Handler();
- mConfig = RecentsConfiguration.reinitialize(context);
+ mConfig = RecentsConfiguration.reinitialize(context, mSystemServicesProxy);
mWindowRect = mSystemServicesProxy.getWindowRect();
mTaskStackBounds = new Rect();
mConfig.getTaskStackBounds(mWindowRect.width(), mWindowRect.height(), mTaskStackBounds);
@@ -147,7 +147,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
}
public void onConfigurationChanged(Configuration newConfig) {
- mConfig = RecentsConfiguration.reinitialize(mContext);
+ mConfig = RecentsConfiguration.reinitialize(mContext, mSystemServicesProxy);
mConfig.updateOnConfigurationChange();
mWindowRect = mSystemServicesProxy.getWindowRect();
mConfig.getTaskStackBounds(mWindowRect.width(), mWindowRect.height(), mTaskStackBounds);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 29a0262..5741f22 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -340,7 +340,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
// Initialize the loader and the configuration
RecentsTaskLoader.initialize(this);
- mConfig = RecentsConfiguration.reinitialize(this);
+ mConfig = RecentsConfiguration.reinitialize(this,
+ RecentsTaskLoader.getInstance().getSystemServicesProxy());
// Create the home intent runnable
Intent homeIntent = new Intent(Intent.ACTION_MAIN, null);
@@ -405,7 +406,8 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
void onConfigurationChange() {
// Update RecentsConfiguration
- mConfig = RecentsConfiguration.reinitialize(this);
+ mConfig = RecentsConfiguration.reinitialize(this,
+ RecentsTaskLoader.getInstance().getSystemServicesProxy());
// Try and start the enter animation (or restart it on configuration changed)
ReferenceCountedTrigger t = new ReferenceCountedTrigger(this, null, null, null);
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
index 439765e..a0cab5c 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsConfiguration.java
@@ -29,6 +29,7 @@ import android.view.animation.AnimationUtils;
import android.view.animation.Interpolator;
import com.android.systemui.R;
import com.android.systemui.recents.misc.Console;
+import com.android.systemui.recents.misc.SystemServicesProxy;
/** A static Recents configuration for the current context
@@ -109,7 +110,8 @@ public class RecentsConfiguration {
public boolean launchedFromHome;
public int launchedToTaskId;
- /** Dev options */
+ /** Dev options and global settings */
+ public boolean lockToAppEnabled;
public boolean developerOptionsEnabled;
public boolean debugModeEnabled;
@@ -127,15 +129,10 @@ public class RecentsConfiguration {
com.android.internal.R.interpolator.linear_out_slow_in);
quintOutInterpolator = AnimationUtils.loadInterpolator(context,
com.android.internal.R.interpolator.decelerate_quint);
-
- // Check if the developer options are enabled
- ContentResolver cr = context.getContentResolver();
- developerOptionsEnabled = Settings.Global.getInt(cr,
- Settings.Global.DEVELOPMENT_SETTINGS_ENABLED, 0) != 0;
}
/** Updates the configuration to the current context */
- public static RecentsConfiguration reinitialize(Context context) {
+ public static RecentsConfiguration reinitialize(Context context, SystemServicesProxy ssp) {
if (sInstance == null) {
sInstance = new RecentsConfiguration(context);
}
@@ -144,6 +141,7 @@ public class RecentsConfiguration {
sInstance.update(context);
sPrevConfigurationHashCode = configHashCode;
}
+ sInstance.updateOnReinitialize(context, ssp);
return sInstance;
}
@@ -260,6 +258,15 @@ public class RecentsConfiguration {
appWidgetId).apply();
}
+ /** Updates the states that need to be re-read whenever we re-initialize. */
+ void updateOnReinitialize(Context context, SystemServicesProxy ssp) {
+ // Check if the developer options are enabled
+ developerOptionsEnabled = ssp.getGlobalSetting(context,
+ Settings.Global.DEVELOPMENT_SETTINGS_ENABLED) != 0;
+ lockToAppEnabled = ssp.getSystemSetting(context,
+ Settings.System.LOCK_TO_APP_ENABLED) != 0;
+ }
+
/** Called when the configuration has changed, and we want to reset any configuration specific
* members. */
public void updateOnConfigurationChange() {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
index ced4043..5fadc71 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/misc/SystemServicesProxy.java
@@ -26,6 +26,7 @@ import android.appwidget.AppWidgetHost;
import android.appwidget.AppWidgetManager;
import android.appwidget.AppWidgetProviderInfo;
import android.content.ComponentName;
+import android.content.ContentResolver;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ActivityInfo;
@@ -47,6 +48,7 @@ import android.os.ParcelFileDescriptor;
import android.os.RemoteException;
import android.os.UserHandle;
import android.os.UserManager;
+import android.provider.Settings;
import android.util.Log;
import android.util.Pair;
import android.view.Display;
@@ -413,6 +415,22 @@ public class SystemServicesProxy {
}
/**
+ * Returns a global setting.
+ */
+ public int getGlobalSetting(Context context, String setting) {
+ ContentResolver cr = context.getContentResolver();
+ return Settings.Global.getInt(cr, setting, 0);
+ }
+
+ /**
+ * Returns a system setting.
+ */
+ public int getSystemSetting(Context context, String setting) {
+ ContentResolver cr = context.getContentResolver();
+ return Settings.System.getInt(cr, setting, 0);
+ }
+
+ /**
* Returns the window rect.
*/
public Rect getWindowRect() {
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
index adf0794..9325947 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/RecentsTaskLoader.java
@@ -27,6 +27,9 @@ import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.os.HandlerThread;
import android.os.UserHandle;
+import android.provider.Settings;
+import android.provider.Settings.SettingNotFoundException;
+
import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.SystemServicesProxy;
@@ -340,7 +343,7 @@ public class RecentsTaskLoader {
// Create a new task
Task task = new Task(t.persistentId, (t.id > -1), t.baseIntent, t.affiliatedTaskId,
activityLabel, activityIcon, activityColor, t.userId, t.firstActiveTime,
- t.lastActiveTime, (i == (taskCount - 1)));
+ t.lastActiveTime, (i == (taskCount - 1)), config.lockToAppEnabled);
// Preload the specified number of apps
if (i >= (taskCount - preloadCount)) {
@@ -395,6 +398,7 @@ public class RecentsTaskLoader {
/** Creates a lightweight stack of the current recent tasks, without thumbnails and icons. */
public static TaskStack getShallowTaskStack(SystemServicesProxy ssp) {
+ RecentsConfiguration config = RecentsConfiguration.getInstance();
List<ActivityManager.RecentTaskInfo> tasks = getRecentTasks(ssp);
TaskStack stack = new TaskStack();
@@ -405,7 +409,8 @@ public class RecentsTaskLoader {
if (info == null) continue;
stack.addTask(new Task(t.persistentId, true, t.baseIntent, t.affiliatedTaskId, null,
- null, 0, 0, t.firstActiveTime, t.lastActiveTime, (i == (taskCount - 1))));
+ null, 0, 0, t.firstActiveTime, t.lastActiveTime, (i == (taskCount - 1)),
+ config.lockToAppEnabled));
}
stack.createAffiliatedGroupings();
return stack;
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
index 2473352..4cf9235 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/Task.java
@@ -84,7 +84,8 @@ public class Task {
public boolean useLightOnPrimaryColor;
public Bitmap thumbnail;
public boolean isActive;
- public boolean canLockToTask;
+ public boolean lockToThisTask;
+ public boolean lockToTaskEnabled;
public int userId;
TaskCallbacks mCb;
@@ -95,7 +96,8 @@ public class Task {
public Task(int id, boolean isActive, Intent intent, int taskAffiliation, String activityTitle,
Drawable activityIcon, int colorPrimary, int userId,
- long firstActiveTime, long lastActiveTime, boolean canLockToTask) {
+ long firstActiveTime, long lastActiveTime, boolean lockToThisTask,
+ boolean lockToTaskEnabled) {
this.key = new TaskKey(id, intent, userId, firstActiveTime, lastActiveTime);
this.taskAffiliation = taskAffiliation;
this.activityLabel = activityTitle;
@@ -104,7 +106,8 @@ public class Task {
this.useLightOnPrimaryColor = Utilities.computeContrastBetweenColors(colorPrimary,
Color.WHITE) > 3f;
this.isActive = isActive;
- this.canLockToTask = canLockToTask;
+ this.lockToThisTask = lockToTaskEnabled && lockToThisTask;
+ this.lockToTaskEnabled = lockToTaskEnabled;
this.userId = userId;
}
diff --git a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
index 13fbe64..fdc5775 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/model/TaskStack.java
@@ -17,6 +17,7 @@
package com.android.systemui.recents.model;
import com.android.systemui.recents.Constants;
+import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.NamedCounter;
import java.util.ArrayList;
@@ -204,10 +205,10 @@ public class TaskStack {
removeGroup(group);
}
// Update the lock-to-app state
- t.canLockToTask = false;
+ t.lockToThisTask = false;
Task newFrontMostTask = getFrontMostTask();
- if (newFrontMostTask != null) {
- newFrontMostTask.canLockToTask = true;
+ if (newFrontMostTask != null && newFrontMostTask.lockToTaskEnabled) {
+ newFrontMostTask.lockToThisTask = true;
}
if (mCb != null) {
// Notify that a task has been removed
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
index bd4ea90..34f0ada 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskStackViewTouchHandler.java
@@ -356,7 +356,7 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
// Disallow touch events from this task view
tv.setTouchEnabled(false);
// Hide the footer
- tv.animateFooterVisibility(false, mSv.mConfig.taskViewLockToAppShortAnimDuration, 0);
+ tv.animateFooterVisibility(false, mSv.mConfig.taskViewLockToAppShortAnimDuration);
// Disallow parents from intercepting touch events
final ViewParent parent = mSv.getParent();
if (parent != null) {
@@ -394,7 +394,7 @@ class TaskStackViewTouchHandler implements SwipeHelper.Callback {
// Re-enable touch events from this task view
tv.setTouchEnabled(true);
// Restore the footer
- tv.animateFooterVisibility(true, mSv.mConfig.taskViewLockToAppShortAnimDuration, 0);
+ tv.animateFooterVisibility(true, mSv.mConfig.taskViewLockToAppShortAnimDuration);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
index 199d3f3..e973717 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/views/TaskView.java
@@ -32,11 +32,9 @@ import android.view.ViewPropertyAnimator;
import android.view.animation.AccelerateInterpolator;
import android.widget.FrameLayout;
import com.android.systemui.R;
-import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.Constants;
import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.model.Task;
-import com.android.systemui.recents.model.TaskStack;
/* A task view */
@@ -314,7 +312,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
mBarView.startEnterRecentsAnimation(0, mEnableThumbnailClip);
setVisibility(View.VISIBLE);
// Animate the footer into view
- animateFooterVisibility(true, mConfig.taskBarEnterAnimDuration, 0);
+ animateFooterVisibility(true, mConfig.taskBarEnterAnimDuration);
// Decrement the post animation trigger
ctx.postAnimationTrigger.decrement();
}
@@ -363,8 +361,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
ctx.postAnimationTrigger.increment();
// Animate the footer into view
- animateFooterVisibility(true, mConfig.taskBarEnterAnimDuration,
- mConfig.taskBarEnterAnimDelay);
+ animateFooterVisibility(true, mConfig.taskBarEnterAnimDuration
+ );
} else {
mEnableThumbnailClip.run();
}
@@ -398,14 +396,14 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
ctx.postAnimationTrigger.increment();
// Animate the footer into view
- animateFooterVisibility(true, mConfig.taskViewEnterFromHomeDuration,
- mConfig.taskBarEnterAnimDelay);
+ animateFooterVisibility(true, mConfig.taskViewEnterFromHomeDuration
+ );
} else {
// Otherwise, just enable the thumbnail clip
mEnableThumbnailClip.run();
// Animate the footer into view
- animateFooterVisibility(true, 0, 0);
+ animateFooterVisibility(true, 0);
}
}
@@ -555,8 +553,8 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
}
/** Animates the footer into and out of view. */
- public void animateFooterVisibility(boolean visible, int duration, int delay) {
- if (!mTask.canLockToTask) {
+ public void animateFooterVisibility(boolean visible, int duration) {
+ if (!mTask.lockToThisTask) {
if (mLockToAppButtonView.getVisibility() == View.VISIBLE) {
mLockToAppButtonView.setVisibility(View.INVISIBLE);
}
@@ -684,9 +682,9 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
mTask.setCallbacks(this);
if (getMeasuredWidth() == 0) {
// If we haven't yet measured, we should just set the footer height with any animation
- animateFooterVisibility(t.canLockToTask, 0, 0);
+ animateFooterVisibility(t.lockToThisTask, 0);
} else {
- animateFooterVisibility(t.canLockToTask, mConfig.taskViewLockToAppLongAnimDuration, 0);
+ animateFooterVisibility(t.lockToThisTask, mConfig.taskViewLockToAppLongAnimDuration);
}
}
@@ -754,7 +752,7 @@ public class TaskView extends FrameLayout implements Task.TaskCallbacks, View.On
}
});
// Hide the footer
- tv.animateFooterVisibility(false, mConfig.taskViewRemoveAnimDuration, 0);
+ tv.animateFooterVisibility(false, mConfig.taskViewRemoveAnimDuration);
} else if (v == tv || v == mLockToAppButtonView) {
mCb.onTaskViewClicked(tv, tv.getTask(), (v == mLockToAppButtonView));
}