Merge "Fix regression in using visibility flags. "
This commit is contained in:
@@ -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);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
*/
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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;
|
||||
@@ -386,6 +387,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);
|
||||
@@ -769,6 +771,11 @@ public abstract class BaseStatusBar extends SystemUI implements
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onVisibilityChanged(boolean visible) {
|
||||
// Do nothing
|
||||
}
|
||||
|
||||
public abstract void resetHeadsUpDecayTimer();
|
||||
|
||||
public abstract void scheduleHeadsUpOpen();
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user