Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5207d9c9 authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Dismiss system windows when screen savers start.

Also add a couple more flags to the intent:
 - NO_HISTORY (finish activity on suspend)
 - FLAG_FROM_BACKGROUND

Bug: 5578434
Change-Id: I97b965175a27760b819dc29ddb57865c5f4754d6
parent 2d54536d
Loading
Loading
Loading
Loading
+7 −2
Original line number Diff line number Diff line
@@ -30,12 +30,17 @@ public class DreamsDockLauncher extends Activity {
                    com.android.internal.R.string.config_defaultDreamComponent);
            }
            if (component != null) {
                // dismiss the notification shade, recents, etc.
                context.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

                ComponentName cn = ComponentName.unflattenFromString(component);
                Intent zzz = new Intent(Intent.ACTION_MAIN)
                    .setComponent(cn)
                    .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                            | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                            | Intent.FLAG_ACTIVITY_NO_USER_ACTION
                            | Intent.FLAG_FROM_BACKGROUND
                            | Intent.FLAG_ACTIVITY_NO_HISTORY
                        );
                Slog.v(TAG, "Starting screen saver on dock event: " + component);
                context.startActivity(zzz);
+5 −0
Original line number Diff line number Diff line
@@ -3475,12 +3475,17 @@ public class PhoneWindowManager implements WindowManagerPolicy {
                    component = mContext.getResources().getString(R.string.config_defaultDreamComponent);
                }
                if (component != null) {
                    // dismiss the notification shade, recents, etc.
                    mContext.sendBroadcast(new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS));

                    ComponentName cn = ComponentName.unflattenFromString(component);
                    Intent intent = new Intent(Intent.ACTION_MAIN)
                        .setComponent(cn)
                        .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK
                            | Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
                            | Intent.FLAG_ACTIVITY_NO_USER_ACTION
                            | Intent.FLAG_FROM_BACKGROUND
                            | Intent.FLAG_ACTIVITY_NO_HISTORY
                            );
                    mContext.startActivity(intent);
                } else {