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

Commit 308302f6 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

DO NOT MERGE Disable overlays while installer is resumed

The install button can be disabled for other reasons, hence we have to
store the enabled state independent of the resumed/paused state.

Bug: 35056974
Change-Id: I2effa0f5afacfaed217a030550a778e32912cfbb
parent 57df7d5d
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -14,6 +14,7 @@
    <uses-permission android:name="android.permission.GRANT_REVOKE_PERMISSIONS" />
    <uses-permission android:name="android.permission.INTERACT_ACROSS_USERS_FULL" />
    <uses-permission android:name="android.permission.READ_INSTALL_SESSIONS" />
    <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />

    <application android:label="@string/app_name"
            android:allowBackup="false"
+22 −0
Original line number Diff line number Diff line
@@ -16,6 +16,8 @@
*/
package com.android.packageinstaller;

import static android.view.WindowManager.LayoutParams.PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;

import android.app.Activity;
import android.app.ActivityManagerNative;
import android.app.AlertDialog;
@@ -425,6 +427,7 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
    @Override
    protected void onCreate(Bundle icicle) {
        super.onCreate(icicle);
        getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);

        mPm = getPackageManager();
        mInstaller = mPm.getPackageInstaller();
@@ -533,6 +536,25 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
        initiateInstall();
    }

    @Override
    protected void onResume() {
        super.onResume();

        if (mOk != null) {
            mOk.setEnabled(mOkCanInstall);
        }
    }

    @Override
    protected void onPause() {
        super.onPause();

        if (mOk != null) {
            // Don't allow the install button to be clicked as there might be overlays
            mOk.setEnabled(false);
        }
    }

    /** Get the ApplicationInfo for the calling package, if available */
    private ApplicationInfo getSourceInfo() {
        String callingPackage = getCallingPackage();