summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2015-03-19 14:11:27 -0700
committerWinson Chung <winsonc@google.com>2015-03-19 14:11:27 -0700
commitd0aa8a374f4de4b02d99d2eef6580ef0f5762912 (patch)
treed75b2c27747614eef9e94042d71af99f58e7acdb /packages/SystemUI
parenta9b33ddf31e9f40698b5ee1255ed505b2a9b7906 (diff)
downloadframeworks_base-d0aa8a374f4de4b02d99d2eef6580ef0f5762912.zip
frameworks_base-d0aa8a374f4de4b02d99d2eef6580ef0f5762912.tar.gz
frameworks_base-d0aa8a374f4de4b02d99d2eef6580ef0f5762912.tar.bz2
Fixing issue with screen-pinning for secondary users.
- Proxy the screen pinning request to the SystemUI for the primary user. Bug: 19395305 Change-Id: I6252d4ee05b2bea4e76b2a4d0b903e2866fffa76
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/Recents.java29
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java10
2 files changed, 32 insertions, 7 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
index 9dd82fc..7f1e876 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java
@@ -42,6 +42,7 @@ import android.view.View;
import com.android.systemui.R;
import com.android.systemui.RecentsComponent;
import com.android.systemui.SystemUI;
+import com.android.systemui.SystemUIApplication;
import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.RecentsTaskLoadPlan;
@@ -53,6 +54,7 @@ import com.android.systemui.recents.views.TaskStackView;
import com.android.systemui.recents.views.TaskStackViewLayoutAlgorithm;
import com.android.systemui.recents.views.TaskViewHeader;
import com.android.systemui.recents.views.TaskViewTransform;
+import com.android.systemui.statusbar.phone.PhoneStatusBar;
import java.util.ArrayList;
import java.util.concurrent.atomic.AtomicBoolean;
@@ -79,6 +81,8 @@ public class Recents extends SystemUI
// Owner proxy events
final public static String ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER =
"action_notify_recents_visibility_change";
+ final public static String ACTION_PROXY_SCREEN_PINNING_REQUEST_TO_OWNER =
+ "action_screen_pinning_request";
final public static String ACTION_START_ENTER_ANIMATION = "action_start_enter_animation";
final public static String ACTION_TOGGLE_RECENTS_ACTIVITY = "action_toggle_recents_activity";
@@ -148,6 +152,9 @@ public class Recents extends SystemUI
case ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER:
visibilityChanged(intent.getBooleanExtra(EXTRA_RECENTS_VISIBILITY, false));
break;
+ case ACTION_PROXY_SCREEN_PINNING_REQUEST_TO_OWNER:
+ onStartScreenPinning(context);
+ break;
}
}
}
@@ -234,6 +241,7 @@ public class Recents extends SystemUI
mProxyBroadcastReceiver = new RecentsOwnerEventProxyReceiver();
IntentFilter filter = new IntentFilter();
filter.addAction(Recents.ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER);
+ filter.addAction(Recents.ACTION_PROXY_SCREEN_PINNING_REQUEST_TO_OWNER);
mContext.registerReceiverAsUser(mProxyBroadcastReceiver, UserHandle.CURRENT, filter,
null, mHandler);
}
@@ -801,6 +809,27 @@ public class Recents extends SystemUI
}
}
+ /** Notifies the status bar to trigger screen pinning. */
+ @ProxyFromAnyToPrimaryUser
+ public static void startScreenPinning(Context context, SystemServicesProxy ssp) {
+ if (ssp.isForegroundUserOwner()) {
+ onStartScreenPinning(context);
+ } else {
+ Intent intent = createLocalBroadcastIntent(context,
+ ACTION_PROXY_SCREEN_PINNING_REQUEST_TO_OWNER);
+ context.sendBroadcastAsUser(intent, UserHandle.OWNER);
+ }
+ }
+ static void onStartScreenPinning(Context context) {
+ // For the primary user, the context for the SystemUI component is the SystemUIApplication
+ SystemUIApplication app = (SystemUIApplication)
+ getInstanceAndStartIfNeeded(context).mContext;
+ PhoneStatusBar statusBar = app.getComponent(PhoneStatusBar.class);
+ if (statusBar != null) {
+ statusBar.showScreenPinningRequest(false);
+ }
+ }
+
/**
* Returns the preloaded load plan and invalidates it.
*/
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 1561f70..b9aec30 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -85,8 +85,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
// Runnables to finish the Recents activity
FinishRecentsRunnable mFinishLaunchHomeRunnable;
- private PhoneStatusBar mStatusBar;
-
/**
* A common Runnable to finish Recents either by calling finish() (with a custom animation) or
* launching Home with some ActivityOptions. Generally we always launch home when we exit
@@ -381,8 +379,6 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
mEmptyViewStub = (ViewStub) findViewById(R.id.empty_view_stub);
mDebugOverlayStub = (ViewStub) findViewById(R.id.debug_overlay_stub);
mScrimViews = new SystemBarScrimViews(this, mConfig);
- mStatusBar = ((SystemUIApplication) getApplication())
- .getComponent(PhoneStatusBar.class);
inflateDebugOverlay();
// Bind the search app widget when we first start up
@@ -650,9 +646,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
@Override
public void onScreenPinningRequest() {
- if (mStatusBar != null) {
- mStatusBar.showScreenPinningRequest(false);
- }
+ RecentsTaskLoader loader = RecentsTaskLoader.getInstance();
+ SystemServicesProxy ssp = loader.getSystemServicesProxy();
+ Recents.startScreenPinning(this, ssp);
}
/**** RecentsAppWidgetHost.RecentsAppWidgetHostCallbacks Implementation ****/