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

Commit 915961a3 authored by Bryce Lee's avatar Bryce Lee
Browse files

Reland "Force remove DreamActivity from system server""

This reverts commit f904724d.

Reason for revert: Issue addressed in ag/21047833

Change-Id: I95674159026b0cce0694d236ca3d887997a4b097
parent 70ecf24b
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -16,6 +16,9 @@

package com.android.server.dreams;

import static android.app.WindowConfiguration.ACTIVITY_TYPE_DREAM;

import android.app.ActivityTaskManager;
import android.app.BroadcastOptions;
import android.content.ComponentName;
import android.content.Context;
@@ -62,6 +65,7 @@ final class DreamController {
    private final Context mContext;
    private final Handler mHandler;
    private final Listener mListener;
    private final ActivityTaskManager mActivityTaskManager;

    private final Intent mDreamingStartedIntent = new Intent(Intent.ACTION_DREAMING_STARTED)
            .addFlags(Intent.FLAG_RECEIVER_REGISTERED_ONLY);
@@ -89,6 +93,7 @@ final class DreamController {
        mContext = context;
        mHandler = handler;
        mListener = listener;
        mActivityTaskManager = mContext.getSystemService(ActivityTaskManager.class);
        mCloseNotificationShadeIntent = new Intent(Intent.ACTION_CLOSE_SYSTEM_DIALOGS);
        mCloseNotificationShadeIntent.putExtra("reason", "dream");
    }
@@ -272,6 +277,9 @@ final class DreamController {
                    mSentStartBroadcast = false;
                }

                mActivityTaskManager.removeRootTasksWithActivityTypes(
                        new int[] {ACTIVITY_TYPE_DREAM});

                mListener.onDreamStopped(dream.mToken);
            }
        } finally {