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

Commit c1d1524b authored by Jaewan Kim's avatar Jaewan Kim
Browse files

PIP: Fix crash when the PIP menu activity is started by intent

This also cleans up unused PIP activities from the Manifest file.

Bug: 37912313
Test: Manual test as follows
  - Checked that my test app crashes when it sends intent to start
    the PIP menu.
  - Checked that starting the PIP menu activity with the am command
    doesn't cause System UI to be crash.
Change-Id: I3a8171fcf6017c2616b8e83ab8a281b5d7e56ab7
parent 271e0aa0
Loading
Loading
Loading
Loading
+3 −16
Original line number Diff line number Diff line
@@ -403,7 +403,8 @@
        <!-- started from PipUI -->
        <activity
            android:name=".pip.tv.PipMenuActivity"
            android:exported="true"
            android:permission="com.android.systemui.permission.SELF"
            android:exported="false"
            android:theme="@style/PipTheme"
            android:launchMode="singleTop"
            android:taskAffinity=""
@@ -412,24 +413,10 @@
            android:supportsPictureInPicture="true"
            androidprv:alwaysFocusable="true"
            android:excludeFromRecents="true" />
        <activity
            android:name=".pip.tv.PipOverlayActivity"
            android:exported="true"
            android:theme="@style/PipTheme"
            android:taskAffinity=""
            android:configChanges="screenSize|smallestScreenSize|screenLayout|orientation|locale|layoutDirection"
            android:resizeableActivity="true"
            android:supportsPictureInPicture="true"
            android:excludeFromRecents="true" />
        <activity
            android:name=".pip.tv.PipOnboardingActivity"
            android:exported="true"
            android:theme="@style/PipTheme"
            android:launchMode="singleTop"
            android:excludeFromRecents="true" />

        <activity
            android:name=".pip.phone.PipMenuActivity"
            android:permission="com.android.systemui.permission.SELF"
            android:theme="@style/PipPhoneOverlayControlTheme"
            android:configChanges="orientation|screenSize|smallestScreenSize|screenLayout"
            android:excludeFromRecents="true"
+8 −0
Original line number Diff line number Diff line
@@ -388,6 +388,11 @@ public class PipMenuActivity extends Activity {

    private void updateFromIntent(Intent intent) {
        mToControllerMessenger = intent.getParcelableExtra(EXTRA_CONTROLLER_MESSENGER);
        if (mToControllerMessenger == null) {
            Log.w(TAG, "Controller messenger is null. Stopping.");
            finish();
            return;
        }
        notifyActivityCallback(mMessenger);

        // Register for HidePipMenuEvents once we notify the controller of this activity
@@ -567,6 +572,9 @@ public class PipMenuActivity extends Activity {
    }

    private void sendMessage(Message m, String errorMsg) {
        if (mToControllerMessenger == null) {
            return;
        }
        try {
            mToControllerMessenger.send(m);
        } catch (RemoteException e) {
+3 −0
Original line number Diff line number Diff line
@@ -45,6 +45,9 @@ public class PipMenuActivity extends Activity implements PipManager.Listener {
    @Override
    protected void onCreate(Bundle bundle) {
        super.onCreate(bundle);
        if (!mPipManager.isPipShown()) {
            finish();
        }
        setContentView(R.layout.tv_pip_menu);
        mPipManager.addListener(this);