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

Commit 4460839e authored by Ivan Podogov's avatar Ivan Podogov
Browse files

Finish resolving conflict from d23dc177

Test: Treehugger
Change-Id: If7fa9f7e300f3d810e41447369ccbbfbc3963b94
parent d97e21c0
Loading
Loading
Loading
Loading
+28 −4
Original line number Original line Diff line number Diff line
@@ -23,6 +23,7 @@ import android.annotation.RequiresPermission;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SdkConstant.SdkConstantType;
import android.annotation.SystemApi;
import android.annotation.SystemApi;
import android.app.ActivityThread;
import android.bluetooth.le.BluetoothLeAdvertiser;
import android.bluetooth.le.BluetoothLeAdvertiser;
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.BluetoothLeScanner;
import android.bluetooth.le.ScanCallback;
import android.bluetooth.le.ScanCallback;
@@ -254,6 +255,29 @@ public final class BluetoothAdapter {
    public static final String ACTION_REQUEST_ENABLE =
    public static final String ACTION_REQUEST_ENABLE =
            "android.bluetooth.adapter.action.REQUEST_ENABLE";
            "android.bluetooth.adapter.action.REQUEST_ENABLE";


    /**
     * Activity Action: Show a system activity that allows the user to turn off
     * Bluetooth. This is used only if permission review is enabled which is for
     * apps targeting API less than 23 require a permission review before any of
     * the app's components can run.
     * <p>This system activity will return once Bluetooth has completed turning
     * off, or the user has decided not to turn Bluetooth off.
     * <p>Notification of the result of this activity is posted using the
     * {@link android.app.Activity#onActivityResult} callback. The
     * <code>resultCode</code>
     * will be {@link android.app.Activity#RESULT_OK} if Bluetooth has been
     * turned off or {@link android.app.Activity#RESULT_CANCELED} if the user
     * has rejected the request or an error has occurred.
     * <p>Applications can also listen for {@link #ACTION_STATE_CHANGED}
     * for global notification whenever Bluetooth is turned on or off.
     * <p>Requires {@link android.Manifest.permission#BLUETOOTH}
     *
     * @hide
     */
    @SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
    public static final String ACTION_REQUEST_DISABLE =
            "android.bluetooth.adapter.action.REQUEST_DISABLE";

    /**
    /**
     * Activity Action: Show a system activity that allows user to enable BLE scans even when
     * Activity Action: Show a system activity that allows user to enable BLE scans even when
     * Bluetooth is turned off.<p>
     * Bluetooth is turned off.<p>
@@ -768,7 +792,7 @@ public final class BluetoothAdapter {
                return true;
                return true;
            }
            }
            if (DBG) Log.d(TAG, "enableBLE(): Calling enable");
            if (DBG) Log.d(TAG, "enableBLE(): Calling enable");
            return mManagerService.enable();
            return mManagerService.enable(ActivityThread.currentPackageName());
        } catch (RemoteException e) {
        } catch (RemoteException e) {
            Log.e(TAG, "", e);
            Log.e(TAG, "", e);
        }
        }
@@ -895,7 +919,7 @@ public final class BluetoothAdapter {
            return true;
            return true;
        }
        }
        try {
        try {
            return mManagerService.enable();
            return mManagerService.enable(ActivityThread.currentPackageName());
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
        return false;
    }
    }
@@ -927,7 +951,7 @@ public final class BluetoothAdapter {
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    @RequiresPermission(Manifest.permission.BLUETOOTH_ADMIN)
    public boolean disable() {
    public boolean disable() {
        try {
        try {
            return mManagerService.disable(true);
            return mManagerService.disable(ActivityThread.currentPackageName(), true);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
        return false;
    }
    }
@@ -945,7 +969,7 @@ public final class BluetoothAdapter {
    public boolean disable(boolean persist) {
    public boolean disable(boolean persist) {


        try {
        try {
            return mManagerService.disable(persist);
            return mManagerService.disable(ActivityThread.currentPackageName(), persist);
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        } catch (RemoteException e) {Log.e(TAG, "", e);}
        return false;
        return false;
    }
    }
+2 −2
Original line number Original line Diff line number Diff line
@@ -34,9 +34,9 @@ interface IBluetoothManager
    void registerStateChangeCallback(in IBluetoothStateChangeCallback callback);
    void registerStateChangeCallback(in IBluetoothStateChangeCallback callback);
    void unregisterStateChangeCallback(in IBluetoothStateChangeCallback callback);
    void unregisterStateChangeCallback(in IBluetoothStateChangeCallback callback);
    boolean isEnabled();
    boolean isEnabled();
    boolean enable();
    boolean enable(String packageName);
    boolean enableNoAutoConnect();
    boolean enableNoAutoConnect();
    boolean disable(boolean persist);
    boolean disable(String packageName, boolean persist);
    int getState();
    int getState();
    IBluetoothGatt getBluetoothGatt();
    IBluetoothGatt getBluetoothGatt();


+2 −2
Original line number Original line Diff line number Diff line
@@ -369,7 +369,7 @@ public final class ActiveServices {
        // we do not start the service and launch a review activity if the calling app
        // we do not start the service and launch a review activity if the calling app
        // is in the foreground passing it a pending intent to start the service when
        // is in the foreground passing it a pending intent to start the service when
        // review is completed.
        // review is completed.
        if (Build.PERMISSIONS_REVIEW_REQUIRED) {
        if (mAm.mPermissionReviewRequired || Build.PERMISSIONS_REVIEW_REQUIRED) {
            if (!requestStartTargetPermissionsReviewIfNeededLocked(r, callingPackage,
            if (!requestStartTargetPermissionsReviewIfNeededLocked(r, callingPackage,
                    callingUid, service, callerFg, userId)) {
                    callingUid, service, callerFg, userId)) {
                return null;
                return null;
@@ -913,7 +913,7 @@ public final class ActiveServices {
        // we schedule binding to the service but do not start its process, then
        // we schedule binding to the service but do not start its process, then
        // we launch a review activity to which is passed a callback to invoke
        // we launch a review activity to which is passed a callback to invoke
        // when done to start the bound service's process to completing the binding.
        // when done to start the bound service's process to completing the binding.
        if (Build.PERMISSIONS_REVIEW_REQUIRED) {
        if (mAm.mPermissionReviewRequired || Build.PERMISSIONS_REVIEW_REQUIRED) {
            if (mAm.getPackageManagerInternalLocked().isPermissionsReviewRequired(
            if (mAm.getPackageManagerInternalLocked().isPermissionsReviewRequired(
                    s.packageName, s.userId)) {
                    s.packageName, s.userId)) {


+6 −1
Original line number Original line Diff line number Diff line
@@ -1576,6 +1576,8 @@ public final class ActivityManagerService extends ActivityManagerNative
    // being called for multiwindow assist in a single session.
    // being called for multiwindow assist in a single session.
    private int mViSessionId = 1000;
    private int mViSessionId = 1000;
    final boolean mPermissionReviewRequired;
    final class KillHandler extends Handler {
    final class KillHandler extends Handler {
        static final int KILL_PROCESS_GROUP_MSG = 4000;
        static final int KILL_PROCESS_GROUP_MSG = 4000;
@@ -2623,6 +2625,9 @@ public final class ActivityManagerService extends ActivityManagerNative
        Slog.i(TAG, "Memory class: " + ActivityManager.staticGetMemoryClass());
        Slog.i(TAG, "Memory class: " + ActivityManager.staticGetMemoryClass());
        mPermissionReviewRequired = mContext.getResources().getBoolean(
                com.android.internal.R.bool.config_permissionReviewRequired);
        mHandlerThread = new ServiceThread(TAG,
        mHandlerThread = new ServiceThread(TAG,
                android.os.Process.THREAD_PRIORITY_FOREGROUND, false /*allowIo*/);
                android.os.Process.THREAD_PRIORITY_FOREGROUND, false /*allowIo*/);
        mHandlerThread.start();
        mHandlerThread.start();
@@ -10882,7 +10887,7 @@ public final class ActivityManagerService extends ActivityManagerNative
                    // If permissions need a review before any of the app components can run,
                    // If permissions need a review before any of the app components can run,
                    // we return no provider and launch a review activity if the calling app
                    // we return no provider and launch a review activity if the calling app
                    // is in the foreground.
                    // is in the foreground.
                    if (Build.PERMISSIONS_REVIEW_REQUIRED) {
                    if (mPermissionReviewRequired || Build.PERMISSIONS_REVIEW_REQUIRED) {
                        if (!requestTargetProviderPermissionsReviewIfNeededLocked(cpi, r, userId)) {
                        if (!requestTargetProviderPermissionsReviewIfNeededLocked(cpi, r, userId)) {
                            return null;
                            return null;
                        }
                        }
+2 −1
Original line number Original line Diff line number Diff line
@@ -416,7 +416,8 @@ class ActivityStarter {
        // If permissions need a review before any of the app components can run, we
        // If permissions need a review before any of the app components can run, we
        // launch the review activity and pass a pending intent to start the activity
        // launch the review activity and pass a pending intent to start the activity
        // we are to launching now after the review is completed.
        // we are to launching now after the review is completed.
        if (Build.PERMISSIONS_REVIEW_REQUIRED && aInfo != null) {
        if ((mService.mPermissionReviewRequired
                || Build.PERMISSIONS_REVIEW_REQUIRED) && aInfo != null) {
            if (mService.getPackageManagerInternalLocked().isPermissionsReviewRequired(
            if (mService.getPackageManagerInternalLocked().isPermissionsReviewRequired(
                    aInfo.packageName, userId)) {
                    aInfo.packageName, userId)) {
                IIntentSender target = mService.getIntentSenderLocked(
                IIntentSender target = mService.getIntentSenderLocked(
Loading