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

Commit ab4e5284 authored by Suprabh Shukla's avatar Suprabh Shukla
Browse files

DO NOT MERGE Fixing Install button not enabled on resume

In cases where an app had a long list of permissions the Install button
was not being enabled.

Test: Manually clicked on an apk that required a long list of
permissions. Checked that the install button is enabled. Switch out and
back to the activity to force a pause/resume. The button gets disabled
and enabled as expected. Also the existing test passes as before:
gts-tradefed run gts-dev -m PackageInstallerTapjacking

Bug: 35056974
Change-Id: I2ef7d5ce4e137969c70d2929271620c2bcb723f2
parent bb22b35a
Loading
Loading
Loading
Loading
+22 −1
Original line number Diff line number Diff line
@@ -51,6 +51,7 @@ import android.widget.Button;
import android.widget.ImageView;
import android.widget.TabHost;
import android.widget.TextView;
import com.android.packageinstaller.permission.ui.OverlayTouchActivity;
import com.android.packageinstaller.permission.utils.Utils;

import java.io.File;
@@ -69,7 +70,8 @@ import java.io.OutputStream;
 * Based on the user response the package is then installed by launching InstallAppConfirm
 * sub activity. All state transitions are handled in this activity
 */
public class PackageInstallerActivity extends Activity implements OnCancelListener, OnClickListener {
public class PackageInstallerActivity extends OverlayTouchActivity implements OnCancelListener,
        OnClickListener {
    private static final String TAG = "PackageInstaller";

    private static final int REQUEST_ENABLE_UNKNOWN_SOURCES = 1;
@@ -218,6 +220,25 @@ public class PackageInstallerActivity extends Activity implements OnCancelListen
        }
    }

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

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

    @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);
        }
    }

    private void showDialogInner(int id) {
        // TODO better fix for this? Remove dialog so that it gets created again
        removeDialog(id);