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

Commit 34e677c3 authored by Etienne Ruffieux's avatar Etienne Ruffieux Committed by Automerger Merge Worker
Browse files

Merge "Restore BluetoothOppLauncherActivity default state" into tm-dev am: 0af0025e

parents 54d535b7 0af0025e
Loading
Loading
Loading
Loading
+9 −2
Original line number Diff line number Diff line
@@ -37,7 +37,6 @@ import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothDevicePicker;
import android.bluetooth.BluetoothSocket;
import android.content.BroadcastReceiver;
import android.content.ComponentName;
import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
@@ -53,6 +52,8 @@ import android.os.Binder;
import android.os.Handler;
import android.os.Message;
import android.os.Process;
import android.os.UserHandle;
import android.os.UserManager;
import android.sysprop.BluetoothProperties;
import android.util.Log;

@@ -251,9 +252,15 @@ public class BluetoothOppService extends ProfileService implements IObexConnecti
            Log.v(TAG, "start()");
        }

        //Check for user restrictions before enabling component
        UserManager mUserManager = getSystemService(UserManager.class);
        if (!mUserManager.hasUserRestrictionForUser(
                UserManager.DISALLOW_BLUETOOTH_SHARING, UserHandle.CURRENT)) {
            setComponentAvailable(LAUNCHER_ACTIVITY, true);
        }

        setComponentAvailable(OPP_PROVIDER, true);
        setComponentAvailable(OPP_FILE_PROVIDER, true);
        setComponentAvailable(LAUNCHER_ACTIVITY, true);
        setComponentAvailable(BT_ENABLE_ACTIVITY, true);
        setComponentAvailable(BT_ERROR_ACTIVITY, true);
        setComponentAvailable(BT_ENABLING_ACTIVITY, true);
+8 −3
Original line number Diff line number Diff line
@@ -2885,9 +2885,14 @@ public class BluetoothManagerService extends IBluetoothManager.Stub {
        final ComponentName oppLauncherComponent = new ComponentName(
                mContext.getPackageManager().getPackagesForUid(Process.BLUETOOTH_UID)[0],
                "com.android.bluetooth.opp.BluetoothOppLauncherActivity");
        final int newState =
                bluetoothSharingDisallowed ? PackageManager.COMPONENT_ENABLED_STATE_DISABLED
                        : PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
        int newState;
        if (bluetoothSharingDisallowed) {
            newState = PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
        } else if (BluetoothProperties.isProfileOppEnabled().orElse(false)) {
            newState = PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
        } else {
            newState = PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
        }
        try {
            mContext.createContextAsUser(userHandle, 0)
                .getPackageManager()