diff options
4 files changed, 13 insertions, 28 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java index dd93389880b0..1d0bfe7dc6f1 100644 --- a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java +++ b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java @@ -20,10 +20,6 @@ import android.view.Display; import android.view.View; public interface RecentsComponent { - public interface Callbacks { - public void onVisibilityChanged(boolean visible); - } - void showRecents(boolean triggeredFromAltTab, View statusBarView); void hideRecents(boolean triggeredFromAltTab, boolean triggeredFromHomeKey); void toggleRecents(Display display, int layoutDirection, View statusBarView); @@ -31,5 +27,4 @@ public interface RecentsComponent { void cancelPreloadingRecents(); void showNextAffiliatedTask(); void showPrevAffiliatedTask(); - void setCallback(Callbacks cb); } diff --git a/packages/SystemUI/src/com/android/systemui/recents/Recents.java b/packages/SystemUI/src/com/android/systemui/recents/Recents.java index 308e7cc9e012..cbccaf887d69 100644 --- a/packages/SystemUI/src/com/android/systemui/recents/Recents.java +++ b/packages/SystemUI/src/com/android/systemui/recents/Recents.java @@ -151,7 +151,8 @@ public class Recents extends SystemUI public void onReceive(Context context, Intent intent) { switch (intent.getAction()) { case ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER: - visibilityChanged(intent.getBooleanExtra(EXTRA_RECENTS_VISIBILITY, false)); + visibilityChanged(context, + intent.getBooleanExtra(EXTRA_RECENTS_VISIBILITY, false)); break; case ACTION_PROXY_SCREEN_PINNING_REQUEST_TO_OWNER: onStartScreenPinning(context); @@ -160,7 +161,6 @@ public class Recents extends SystemUI } } - static RecentsComponent.Callbacks sRecentsComponentCallbacks; static RecentsTaskLoadPlan sInstanceLoadPlan; static Recents sInstance; @@ -834,18 +834,12 @@ public class Recents extends SystemUI mCanReuseTaskStackViews = true; } - /** Sets the RecentsComponent callbacks. */ - @Override - public void setCallback(RecentsComponent.Callbacks cb) { - sRecentsComponentCallbacks = cb; - } - /** Notifies the callbacks that the visibility of Recents has changed. */ @ProxyFromAnyToSystemUser public static void notifyVisibilityChanged(Context context, SystemServicesProxy ssp, boolean visible) { if (ssp.isForegroundUserSystem()) { - visibilityChanged(visible); + visibilityChanged(context, visible); } else { Intent intent = createLocalBroadcastIntent(context, ACTION_PROXY_NOTIFY_RECENTS_VISIBLITY_TO_OWNER); @@ -853,9 +847,13 @@ public class Recents extends SystemUI context.sendBroadcastAsUser(intent, UserHandle.SYSTEM); } } - static void visibilityChanged(boolean visible) { - if (sRecentsComponentCallbacks != null) { - sRecentsComponentCallbacks.onVisibilityChanged(visible); + static void visibilityChanged(Context context, boolean visible) { + // For the primary user, the context for the SystemUI component is the SystemUIApplication + SystemUIApplication app = (SystemUIApplication) + getInstanceAndStartIfNeeded(context.getApplicationContext()).mContext; + PhoneStatusBar statusBar = app.getComponent(PhoneStatusBar.class); + if (statusBar != null) { + statusBar.updateRecentsVisibility(visible); } } @@ -873,7 +871,7 @@ public class Recents extends SystemUI static void onStartScreenPinning(Context context) { // For the primary user, the context for the SystemUI component is the SystemUIApplication SystemUIApplication app = (SystemUIApplication) - getInstanceAndStartIfNeeded(context).mContext; + getInstanceAndStartIfNeeded(context.getApplicationContext()).mContext; PhoneStatusBar statusBar = app.getComponent(PhoneStatusBar.class); if (statusBar != null) { statusBar.showScreenPinningRequest(false); diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java index 2c964be44cac..e7a3c8a3fe72 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java @@ -115,8 +115,7 @@ import static com.android.keyguard.KeyguardHostView.OnDismissAction; public abstract class BaseStatusBar extends SystemUI implements CommandQueue.Callbacks, ActivatableNotificationView.OnActivatedListener, - RecentsComponent.Callbacks, ExpandableNotificationRow.ExpansionLogger, - NotificationData.Environment { + ExpandableNotificationRow.ExpansionLogger, NotificationData.Environment { public static final String TAG = "StatusBar"; public static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG); public static final boolean MULTIUSER_DEBUG = false; @@ -577,7 +576,6 @@ public abstract class BaseStatusBar extends SystemUI implements ServiceManager.getService(Context.STATUS_BAR_SERVICE)); mRecents = getComponent(Recents.class); - mRecents.setCallback(this); final Configuration currentConfig = mContext.getResources().getConfiguration(); mLocale = currentConfig.locale; @@ -1174,11 +1172,6 @@ public abstract class BaseStatusBar extends SystemUI implements } } - @Override - public void onVisibilityChanged(boolean visible) { - // Do nothing - } - /** * If there is an active heads-up notification and it has a fullscreen intent, fire it now. */ diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 7f4be65c946f..151fa3c5a033 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -4106,8 +4106,7 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode, super.toggleRecents(); } - @Override - public void onVisibilityChanged(boolean visible) { + public void updateRecentsVisibility(boolean visible) { // Update the recents visibility flag if (visible) { mSystemUiVisibility |= View.RECENT_APPS_VISIBLE; |