Loading service/java/com/android/server/bluetooth/BluetoothManagerService.java +0 −51 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import android.content.pm.UserInfo; import android.database.ContentObserver; import android.os.Binder; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading @@ -52,8 +51,6 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.os.UserManagerInternal; import android.os.UserManagerInternal.UserRestrictionsListener; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.util.Slog; Loading Loading @@ -179,24 +176,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } }; private final UserRestrictionsListener mUserRestrictionsListener = new UserRestrictionsListener() { @Override public void onUserRestrictionsChanged(int userId, Bundle newRestrictions, Bundle prevRestrictions) { final boolean bluetoothDisallowed = newRestrictions.getBoolean(UserManager.DISALLOW_BLUETOOTH); if ((mEnable || mEnableExternal) && bluetoothDisallowed) { try { disable(null, true); } catch (RemoteException e) { Slog.w(TAG, "Exception when disabling Bluetooth from UserRestrictionsListener", e); } } } }; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading Loading @@ -633,13 +612,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { public boolean enableNoAutoConnect() { if (isBluetoothDisallowed()) { if (DBG) { Slog.d(TAG, "enableNoAutoConnect(): not enabling - bluetooth disallowed"); } return false; } mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); Loading @@ -665,13 +637,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { final int callingUid = Binder.getCallingUid(); final boolean callerSystem = UserHandle.getAppId(callingUid) == Process.SYSTEM_UID; if (isBluetoothDisallowed()) { if (DBG) { Slog.d(TAG,"enable(): not enabling - bluetooth disallowed"); } return false; } if (!callerSystem) { if (!checkIfCallerIsForegroundUser()) { Slog.w(TAG, "enable(): not allowed for non-active and non system user"); Loading Loading @@ -876,12 +841,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { */ public void handleOnBootPhase() { if (DBG) Slog.d(TAG, "Bluetooth boot completed"); UserManagerInternal userManagerInternal = LocalServices.getService(UserManagerInternal.class); userManagerInternal.addUserRestrictionsListener(mUserRestrictionsListener); if (isBluetoothDisallowed()) { return; } if (mEnableExternal && isBluetoothPersistedStateOnBluetooth()) { if (DBG) Slog.d(TAG, "Auto-enabling Bluetooth."); sendEnableMsg(mQuietEnableExternal); Loading Loading @@ -1924,16 +1883,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } } private boolean isBluetoothDisallowed() { long callingIdentity = Binder.clearCallingIdentity(); try { return mContext.getSystemService(UserManager.class) .hasUserRestriction(UserManager.DISALLOW_BLUETOOTH, UserHandle.SYSTEM); } finally { Binder.restoreCallingIdentity(callingIdentity); } } @Override public void dump(FileDescriptor fd, PrintWriter writer, String[] args) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG); Loading Loading
service/java/com/android/server/bluetooth/BluetoothManagerService.java +0 −51 Original line number Diff line number Diff line Loading @@ -41,7 +41,6 @@ import android.content.pm.UserInfo; import android.database.ContentObserver; import android.os.Binder; import android.os.Build; import android.os.Bundle; import android.os.Handler; import android.os.IBinder; import android.os.Looper; Loading @@ -52,8 +51,6 @@ import android.os.RemoteException; import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.os.UserManagerInternal; import android.os.UserManagerInternal.UserRestrictionsListener; import android.provider.Settings; import android.provider.Settings.SettingNotFoundException; import android.util.Slog; Loading Loading @@ -179,24 +176,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } }; private final UserRestrictionsListener mUserRestrictionsListener = new UserRestrictionsListener() { @Override public void onUserRestrictionsChanged(int userId, Bundle newRestrictions, Bundle prevRestrictions) { final boolean bluetoothDisallowed = newRestrictions.getBoolean(UserManager.DISALLOW_BLUETOOTH); if ((mEnable || mEnableExternal) && bluetoothDisallowed) { try { disable(null, true); } catch (RemoteException e) { Slog.w(TAG, "Exception when disabling Bluetooth from UserRestrictionsListener", e); } } } }; private final BroadcastReceiver mReceiver = new BroadcastReceiver() { @Override public void onReceive(Context context, Intent intent) { Loading Loading @@ -633,13 +612,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { public boolean enableNoAutoConnect() { if (isBluetoothDisallowed()) { if (DBG) { Slog.d(TAG, "enableNoAutoConnect(): not enabling - bluetooth disallowed"); } return false; } mContext.enforceCallingOrSelfPermission(BLUETOOTH_ADMIN_PERM, "Need BLUETOOTH ADMIN permission"); Loading @@ -665,13 +637,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { final int callingUid = Binder.getCallingUid(); final boolean callerSystem = UserHandle.getAppId(callingUid) == Process.SYSTEM_UID; if (isBluetoothDisallowed()) { if (DBG) { Slog.d(TAG,"enable(): not enabling - bluetooth disallowed"); } return false; } if (!callerSystem) { if (!checkIfCallerIsForegroundUser()) { Slog.w(TAG, "enable(): not allowed for non-active and non system user"); Loading Loading @@ -876,12 +841,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { */ public void handleOnBootPhase() { if (DBG) Slog.d(TAG, "Bluetooth boot completed"); UserManagerInternal userManagerInternal = LocalServices.getService(UserManagerInternal.class); userManagerInternal.addUserRestrictionsListener(mUserRestrictionsListener); if (isBluetoothDisallowed()) { return; } if (mEnableExternal && isBluetoothPersistedStateOnBluetooth()) { if (DBG) Slog.d(TAG, "Auto-enabling Bluetooth."); sendEnableMsg(mQuietEnableExternal); Loading Loading @@ -1924,16 +1883,6 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } } private boolean isBluetoothDisallowed() { long callingIdentity = Binder.clearCallingIdentity(); try { return mContext.getSystemService(UserManager.class) .hasUserRestriction(UserManager.DISALLOW_BLUETOOTH, UserHandle.SYSTEM); } finally { Binder.restoreCallingIdentity(callingIdentity); } } @Override public void dump(FileDescriptor fd, PrintWriter writer, String[] args) { mContext.enforceCallingOrSelfPermission(android.Manifest.permission.DUMP, TAG); Loading