summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2014-06-12 13:59:25 -0700
committerWinson Chung <winsonc@google.com>2014-06-12 13:59:25 -0700
commit9214eff52adf56b7c9532e40b784d52f9f94b6d1 (patch)
treeee0e6ad31b243d4a433d42c91fde2c4e606c2958
parentd42a6cfe2bf632222617450a1ed340268e82f06c (diff)
downloadframeworks_base-9214eff52adf56b7c9532e40b784d52f9f94b6d1.zip
frameworks_base-9214eff52adf56b7c9532e40b784d52f9f94b6d1.tar.gz
frameworks_base-9214eff52adf56b7c9532e40b784d52f9f94b6d1.tar.bz2
Fix regression in using visibility flags.
-rw-r--r--packages/SystemUI/src/com/android/systemui/RecentsComponent.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/recent/Recents.java7
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java14
-rw-r--r--packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java20
6 files changed, 63 insertions, 1 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java
index 7c85712..9650435 100644
--- a/packages/SystemUI/src/com/android/systemui/RecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/RecentsComponent.java
@@ -20,9 +20,14 @@ 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);
void toggleRecents(Display display, int layoutDirection, View statusBarView);
void preloadRecents();
void cancelPreloadingRecents();
+ void setCallback(Callbacks cb);
}
diff --git a/packages/SystemUI/src/com/android/systemui/recent/Recents.java b/packages/SystemUI/src/com/android/systemui/recent/Recents.java
index 116d755..e03c01c 100644
--- a/packages/SystemUI/src/com/android/systemui/recent/Recents.java
+++ b/packages/SystemUI/src/com/android/systemui/recent/Recents.java
@@ -273,6 +273,13 @@ public class Recents extends SystemUI implements RecentsComponent {
}
}
+ @Override
+ public void setCallback(Callbacks cb) {
+ if (mUseAlternateRecents) {
+ mAlternateRecents.setRecentsComponentCallback(cb);
+ }
+ }
+
/**
* Send broadcast only if BOOT_COMPLETED
*/
diff --git a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
index 6d44f06..8861752 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/AlternateRecentsComponent.java
@@ -38,6 +38,7 @@ import android.os.UserHandle;
import android.view.View;
import android.view.WindowManager;
import com.android.systemui.R;
+import com.android.systemui.RecentsComponent;
import java.lang.ref.WeakReference;
import java.util.Iterator;
@@ -143,6 +144,7 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
final static String sRecentsService = "com.android.systemui.recents.RecentsService";
static Bitmap sLastScreenshot;
+ static RecentsComponent.Callbacks sRecentsComponentCallbacks;
Context mContext;
SystemServicesProxy mSystemServicesProxy;
@@ -556,6 +558,18 @@ public class AlternateRecentsComponent implements ActivityOptions.OnAnimationSta
}
}
+ /** Sets the RecentsComponent callbacks. */
+ public void setRecentsComponentCallback(RecentsComponent.Callbacks cb) {
+ sRecentsComponentCallbacks = cb;
+ }
+
+ /** Notifies the callbacks that the visibility of Recents has changed. */
+ public static void notifyVisibilityChanged(boolean visible) {
+ if (sRecentsComponentCallbacks != null) {
+ sRecentsComponentCallbacks.onVisibilityChanged(visible);
+ }
+ }
+
/**** OnAnimationStartedListener Implementation ****/
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
index 9800271..f9c219b 100644
--- a/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
+++ b/packages/SystemUI/src/com/android/systemui/recents/RecentsActivity.java
@@ -140,6 +140,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
BroadcastReceiver mScreenOffReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
+ // Mark recents as no longer visible
+ AlternateRecentsComponent.notifyVisibilityChanged(false);
+ // Finish without an animations
finish();
}
};
@@ -148,6 +151,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
Runnable mFinishRunnable = new Runnable() {
@Override
public void run() {
+ // Mark recents as no longer visible
+ AlternateRecentsComponent.notifyVisibilityChanged(false);
+ // Finish with an animations
finish();
overridePendingTransition(R.anim.recents_to_launcher_enter,
R.anim.recents_to_launcher_exit);
@@ -589,6 +595,9 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
.withLayer()
.start();
}
+
+ // Mark recents as no longer visible
+ AlternateRecentsComponent.notifyVisibilityChanged(false);
}
@Override
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
index 5a9fe91..c00715a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/BaseStatusBar.java
@@ -89,7 +89,8 @@ import java.util.Locale;
import static com.android.keyguard.KeyguardHostView.OnDismissAction;
public abstract class BaseStatusBar extends SystemUI implements
- CommandQueue.Callbacks, ActivatableNotificationView.OnActivatedListener {
+ CommandQueue.Callbacks, ActivatableNotificationView.OnActivatedListener,
+ RecentsComponent.Callbacks {
public static final String TAG = "StatusBar";
public static final boolean DEBUG = false;
public static final boolean MULTIUSER_DEBUG = false;
@@ -385,6 +386,7 @@ public abstract class BaseStatusBar extends SystemUI implements
ServiceManager.getService(Context.STATUS_BAR_SERVICE));
mRecents = getComponent(RecentsComponent.class);
+ mRecents.setCallback(this);
mLocale = mContext.getResources().getConfiguration().locale;
mLayoutDirection = TextUtils.getLayoutDirectionFromLocale(mLocale);
@@ -764,6 +766,11 @@ public abstract class BaseStatusBar extends SystemUI implements
}
}
+ @Override
+ public void onVisibilityChanged(boolean visible) {
+ // Do nothing
+ }
+
public abstract void resetHeadsUpDecayTimer();
public abstract void scheduleHeadsUpOpen();
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 a38d18c..a2dbf75 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -1949,6 +1949,10 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
Integer.toHexString(oldVal), Integer.toHexString(newVal),
Integer.toHexString(diff)));
if (diff != 0) {
+ // we never set the recents bit via this method, so save the prior state to prevent
+ // clobbering the bit below
+ final boolean wasRecentsVisible = (mSystemUiVisibility & View.RECENT_APPS_VISIBLE) > 0;
+
mSystemUiVisibility = newVal;
// update low profile
@@ -2003,6 +2007,11 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
mSystemUiVisibility &= ~View.NAVIGATION_BAR_UNHIDE;
}
+ // restore the recents bit
+ if (wasRecentsVisible) {
+ mSystemUiVisibility |= View.RECENT_APPS_VISIBLE;
+ }
+
// send updated sysui visibility to window manager
notifyUiVisibilityChanged(mSystemUiVisibility);
}
@@ -3159,4 +3168,15 @@ public class PhoneStatusBar extends BaseStatusBar implements DemoMode,
notifyUiVisibilityChanged(mSystemUiVisibility);
super.toggleRecents();
}
+
+ @Override
+ public void onVisibilityChanged(boolean visible) {
+ // Update the recents visibility flag
+ if (visible) {
+ mSystemUiVisibility |= View.RECENT_APPS_VISIBLE;
+ } else {
+ mSystemUiVisibility &= ~View.RECENT_APPS_VISIBLE;
+ }
+ notifyUiVisibilityChanged(mSystemUiVisibility);
+ }
}