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

Commit 8d71081e authored by Sravan Kumar V's avatar Sravan Kumar V
Browse files

Revert "Multiuser: Check if valid user before starting service"

This reverts commit cd271a3a
which were preventing services from gettign started. Checks
are not required now as handling for socket listening is now
added in AdapterService code.

Change-Id: I3b819b3fe665951c3d7e0bca13a4da6287c8890e
CRs-Fixed: 992642
parent 5ef39577
Loading
Loading
Loading
Loading
+0 −4
Original line number Diff line number Diff line
@@ -204,19 +204,15 @@ final public class Utils {
        int callingUser = UserHandle.getCallingUserId();
        int callingUid = Binder.getCallingUid();
        long ident = Binder.clearCallingIdentity();
        Log.d(TAG,"callingUid =" + callingUid);

        try {
            // With calling identity cleared the current user is the foreground user.
            int foregroundUser = ActivityManager.getCurrentUser();
            ok = (foregroundUser == callingUser);
            Log.e(TAG, "foregroundUser =" + foregroundUser);
            Log.e(TAG, "callingUser =" + callingUser);
            if (!ok) {
                // Always allow SystemUI/System access.
                int systemUiUid = ActivityThread.getPackageManager().getPackageUid(
                        "com.android.systemui", UserHandle.USER_OWNER);
                Log.d(TAG," systemUiUid :" + systemUiUid);
                ok = (systemUiUid == callingUid) || (Process.SYSTEM_UID == callingUid);
            }
        } catch (Exception ex) {
+0 −5
Original line number Diff line number Diff line
@@ -594,17 +594,12 @@ public class BluetoothMapService extends ProfileService {
        if(!VERBOSE)
        VERBOSE = Log.isLoggable(LOG_TAG, Log.VERBOSE);

        if (!Utils.checkCaller()) {
            Log.w(TAG, "start received for non-active user, ignoring");
            return false;
        }
        //Start MapProfile if not already done.
        if (isMapStarted()) {
            Log.w(TAG, "start received for already started, ignoring");
            return false;
        }


        if (VERBOSE) Log.v(TAG, "verbose logging is enabled");
        HandlerThread thread = new HandlerThread("BluetoothMapHandler");
        thread.start();
+0 −7
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import android.database.Cursor;
import android.net.Uri;
import android.util.Log;
import android.widget.Toast;
import com.android.bluetooth.Utils;

/**
 * Receives and handles: system broadcasts; Intents from other applications;
@@ -64,12 +63,6 @@ public class BluetoothOppReceiver extends BroadcastReceiver {
        String action = intent.getAction();
        if (D) Log.d(TAG, "Action :" + action);

        /* Ignore if Broadcast action is not transfer complete and Invalid user */
        if (!Utils.checkCaller() && !action.equals(BluetoothShare.TRANSFER_COMPLETED_ACTION)) {
            Log.w(TAG, action + " received for non-active user, ignoring!!");
            return;
        }
        if (V) Log.v(TAG, action + " Intent received for active user");

        if (action.equals(BluetoothAdapter.ACTION_STATE_CHANGED)) {
            if (BluetoothAdapter.STATE_ON == intent.getIntExtra(
+0 −4
Original line number Diff line number Diff line
@@ -200,10 +200,6 @@ public class BluetoothPbapService extends Service {
        mInterrupted = false;
        mAdapter = BluetoothAdapter.getDefaultAdapter();

        if (!Utils.checkCaller()) {
            Log.w(TAG, "onCreate received for non-active user, ignoring");
            return;
        }

        if (!mHasStarted) {
            mHasStarted = true;