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

Commit 995e11c2 authored by android-build-team Robot's avatar android-build-team Robot
Browse files

release-request-5ee66a34-3e58-4de0-ba73-1f49074ee497-for-git_oc-mr1-release-41...

release-request-5ee66a34-3e58-4de0-ba73-1f49074ee497-for-git_oc-mr1-release-4169335 snap-temp-L20600000081126177

Change-Id: I86637ae3e44a2eb7dfb4cd5e13d1a1161db3f607
parents 82490639 0045f3d1
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@
    <uses-permission android:name="android.permission.KILL_UID" />
    <uses-permission android:name="android.permission.MANAGE_APP_OPS_RESTRICTIONS" />
    <uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" />
    <uses-permission android:name="android.permission.HIDE_NON_SYSTEM_OVERLAY_WINDOWS" />

    <uses-permission android:name="com.google.android.permission.INSTALL_WEARABLE_PACKAGES" />

+9 −9
Original line number Diff line number Diff line
@@ -21,6 +21,7 @@ import android.app.Activity;
import android.app.ActivityManager;
import android.app.AppGlobals;
import android.app.IActivityManager;
import android.content.ContentResolver;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.IPackageManager;
@@ -42,7 +43,6 @@ import com.android.internal.annotations.VisibleForTesting;
public class InstallStart extends Activity {
    private static final String LOG_TAG = InstallStart.class.getSimpleName();

    private static final String SCHEME_CONTENT = "content";
    private static final String DOWNLOADS_AUTHORITY = "downloads";
    private IActivityManager mIActivityManager;
    private IPackageManager mIPackageManager;
@@ -105,20 +105,20 @@ public class InstallStart extends Activity {
        } else {
            Uri packageUri = intent.getData();

            if (packageUri == null) {
                // if there's nothing to do, quietly slip into the ether
            if (packageUri != null && (packageUri.getScheme().equals(ContentResolver.SCHEME_FILE)
                    || packageUri.getScheme().equals(ContentResolver.SCHEME_CONTENT))) {
                // Copy file to prevent it from being changed underneath this process
                nextActivity.setClass(this, InstallStaging.class);
            } else if (packageUri != null && packageUri.getScheme().equals(
                    PackageInstallerActivity.SCHEME_PACKAGE)) {
                nextActivity.setClass(this, PackageInstallerActivity.class);
            } else {
                Intent result = new Intent();
                result.putExtra(Intent.EXTRA_INSTALL_RESULT,
                        PackageManager.INSTALL_FAILED_INVALID_URI);
                setResult(RESULT_FIRST_USER, result);

                nextActivity = null;
            } else {
                if (packageUri.getScheme().equals(SCHEME_CONTENT)) {
                    nextActivity.setClass(this, InstallStaging.class);
                } else {
                    nextActivity.setClass(this, PackageInstallerActivity.class);
                }
            }
        }

+4 −7
Original line number Diff line number Diff line
@@ -25,6 +25,7 @@ import android.app.DialogFragment;
import android.app.Fragment;
import android.app.FragmentTransaction;
import android.content.ActivityNotFoundException;
import android.content.ContentResolver;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
@@ -75,8 +76,7 @@ public class PackageInstallerActivity extends OverlayTouchActivity implements On

    private static final int REQUEST_TRUST_EXTERNAL_SOURCE = 1;

    private static final String SCHEME_FILE = "file";
    private static final String SCHEME_PACKAGE = "package";
    static final String SCHEME_PACKAGE = "package";

    static final String EXTRA_CALLING_PACKAGE = "EXTRA_CALLING_PACKAGE";
    static final String EXTRA_ORIGINAL_SOURCE_INFO = "EXTRA_ORIGINAL_SOURCE_INFO";
@@ -581,7 +581,7 @@ public class PackageInstallerActivity extends OverlayTouchActivity implements On
                        mPm.getApplicationIcon(mPkgInfo.applicationInfo));
            } break;

            case SCHEME_FILE: {
            case ContentResolver.SCHEME_FILE: {
                File sourceFile = new File(packageUri.getPath());
                PackageParser.Package parsed = PackageUtil.getPackageInfo(this, sourceFile);

@@ -599,10 +599,7 @@ public class PackageInstallerActivity extends OverlayTouchActivity implements On
            } break;

            default: {
                Log.w(TAG, "Unsupported scheme " + scheme);
                setPmResult(PackageManager.INSTALL_FAILED_INVALID_URI);
                finish();
                return false;
                throw new IllegalArgumentException("Unexpected URI scheme " + packageUri);
            }
        }

+6 −25
Original line number Diff line number Diff line
@@ -15,34 +15,15 @@
 */
package com.android.packageinstaller.permission.ui;

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

import android.app.Activity;
import android.app.AppOpsManager;
import android.os.Binder;
import android.os.IBinder;
import android.os.UserHandle;
import android.os.Bundle;

public class OverlayTouchActivity extends Activity {
    private final IBinder mToken = new Binder();

    @Override
    protected void onResume() {
        super.onResume();
        setOverlayAllowed(false);
    }

    @Override
    protected void onPause() {
        super.onPause();
        setOverlayAllowed(true);
    }

    private void setOverlayAllowed(boolean allowed) {
        AppOpsManager appOpsManager = getSystemService(AppOpsManager.class);
        if (appOpsManager != null) {
            appOpsManager.setUserRestrictionForUser(AppOpsManager.OP_SYSTEM_ALERT_WINDOW, !allowed,
                    mToken, null, UserHandle.USER_ALL);
            appOpsManager.setUserRestrictionForUser(AppOpsManager.OP_TOAST_WINDOW, !allowed,
                    mToken, null, UserHandle.USER_ALL);
        }
    protected void onCreate(Bundle savedInstanceState) {
        getWindow().addPrivateFlags(PRIVATE_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
        super.onCreate(savedInstanceState);
    }
}