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

Commit 9f984b12 authored by Steve Kondik's avatar Steve Kondik Committed by Gerrit Code Review
Browse files

Merge "Fix setting connection status when switching profiles via 3rd party apps." into gingerbread

parents 28ddc1f1 6d51e19e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import org.xmlpull.v1.XmlPullParserException;
import java.io.IOException;

/** @hide */
public class ConnectionSettings implements Parcelable {
public final class ConnectionSettings implements Parcelable {

    private int mConnectionId;
    private int mValue;
+1 −1
Original line number Diff line number Diff line
@@ -33,7 +33,7 @@ import java.util.HashMap;
import java.util.Map;
import java.util.UUID;

public class Profile implements Parcelable {
public final class Profile implements Parcelable {

    private String mName;
    private int mNameResId;
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ import android.util.Log;
import java.io.IOException;
import java.util.UUID;

public class ProfileGroup implements Parcelable {
public final class ProfileGroup implements Parcelable {
    private static final String TAG = "ProfileGroup";

    private String mName;
+1 −1
Original line number Diff line number Diff line
@@ -11,7 +11,7 @@ import android.os.Parcelable;
import java.io.IOException;

/** @hide */
public class StreamSettings implements Parcelable{
public final class StreamSettings implements Parcelable{

    private int mStreamId;
    private int mValue;
+8 −10
Original line number Diff line number Diff line
@@ -182,19 +182,16 @@ public class ProfileManagerService extends IProfileManager.Stub {
            if (doinit) {
                if (LOCAL_LOGV) Log.v(TAG, "setActiveProfile(Profile, boolean) - Running init");

                // Call profile's "doSelect"
                mActiveProfile.doSelect(mContext);

                /*
                 * Clearing the calling identity AFTER the profile doSelect
                 * to reduce security risks based on an external class extending the
                 * Profile class and embedding malicious code to be executed with "system" rights.
                 * This isn't a fool-proof safety measure, but it's better than giving
                 * the child class system-level access by simply calling setActiveProfile.
                 *
                 * We need to clear the permissions to broadcast INTENT_ACTION_PROFILE_SELECTED.
                 * We need to clear the caller's identity in order to
                 * - allow the profile switch to execute actions not included in the caller's permissions
                 * - broadcast INTENT_ACTION_PROFILE_SELECTED
                 */
                long token = clearCallingIdentity();

                // Call profile's "doSelect"
                mActiveProfile.doSelect(mContext);

                // Notify other applications of newly selected profile.
                Intent broadcast = new Intent(INTENT_ACTION_PROFILE_SELECTED);
                broadcast.putExtra("name", mActiveProfile.getName());
@@ -202,6 +199,7 @@ public class ProfileManagerService extends IProfileManager.Stub {
                broadcast.putExtra("lastName", lastProfile.getName());
                broadcast.putExtra("lastUuid", lastProfile.getUuid().toString());
                mContext.sendBroadcast(broadcast);

                restoreCallingIdentity(token);
                persistIfDirty();
            }