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

Commit ab79d252 authored by Abhisek Devkota's avatar Abhisek Devkota Committed by Gerrit Code Review
Browse files

Merge "Revert "framework: Privacy Guard"" into cm-10.2

parents 8b9e41d7 b8d1ef87
Loading
Loading
Loading
Loading
+0 −22
Original line number Diff line number Diff line
@@ -1888,15 +1888,6 @@ public abstract class ActivityManagerNative extends Binder implements IActivityM
            return true;
        }

        case IS_PRIVACY_GUARD_ENABLED_TRANSACTION: {
            data.enforceInterface(IActivityManager.descriptor);
            int pid = data.readInt();
            boolean res = isPrivacyGuardEnabledForProcess(pid);
            reply.writeNoException();
            reply.writeInt(res ? 1 : 0);
            return true;
        }

        }

        return super.onTransact(code, data, reply, flags);
@@ -4322,18 +4313,5 @@ class ActivityManagerProxy implements IActivityManager
        reply.recycle();
    }

    public boolean isPrivacyGuardEnabledForProcess(int pid) throws RemoteException {
        Parcel data = Parcel.obtain();
        Parcel reply = Parcel.obtain();
        data.writeInterfaceToken(IActivityManager.descriptor);
        data.writeInt(pid);
        mRemote.transact(IS_PRIVACY_GUARD_ENABLED_TRANSACTION, data, reply, 0);
        reply.readException();
        int res = reply.readInt();
        data.recycle();
        reply.recycle();
        return res == 1;
    }

    private IBinder mRemote;
}
+0 −20
Original line number Diff line number Diff line
@@ -48,7 +48,6 @@ import android.content.res.Resources;
import android.content.res.XmlResourceParser;
import android.graphics.drawable.Drawable;
import android.net.Uri;
import android.os.Binder;
import android.os.Process;
import android.os.RemoteException;
import android.os.UserHandle;
@@ -1310,25 +1309,6 @@ final class ApplicationPackageManager extends PackageManager {
        return PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
    }

    @Override
    public void setPrivacyGuardSetting(String packageName, boolean enabled) {
        try {
            mPM.setPrivacyGuardSetting(packageName, enabled, mContext.getUserId());
        } catch (RemoteException e) {
            // Should never happen!
        }
    }

    @Override
    public boolean getPrivacyGuardSetting(String packageName) {
        try {
            return mPM.getPrivacyGuardSetting(packageName, mContext.getUserId());
        } catch (RemoteException e) {
            // Should never happen!
        }
        return false;
    }

    /**
     * @hide
     */
+0 −10
Original line number Diff line number Diff line
@@ -1592,16 +1592,6 @@ class ContextImpl extends Context {
        return new DropBoxManager(service);
    }

    @Override
    public boolean isPrivacyGuardEnabled() {
        try {
            return ActivityManagerNative.getDefault().isPrivacyGuardEnabledForProcess(Binder.getCallingPid());
        } catch (RemoteException e) {
            Log.e(TAG, e.getMessage(), e);
        }
        return false;
    }

    @Override
    public int checkPermission(String permission, int pid, int uid) {
        if (permission == null) {
+1 −4
Original line number Diff line number Diff line
@@ -192,8 +192,6 @@ public interface IActivityManager extends IInterface {
    public void setProcessForeground(IBinder token, int pid,
            boolean isForeground) throws RemoteException;
    
    public boolean isPrivacyGuardEnabledForProcess(int pid) throws RemoteException;

    public int checkPermission(String permission, int pid, int uid)
            throws RemoteException;

@@ -644,6 +642,5 @@ public interface IActivityManager extends IInterface {
    int KILL_UID_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+164;
    int SET_USER_IS_MONKEY_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+165;
    int HANG_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+166;
    int IS_PRIVACY_GUARD_ENABLED_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+167;
    int GET_CALLING_PACKAGE_FOR_BROADCAST_TRANSACTION = IBinder.FIRST_CALL_TRANSACTION+168;
}
+0 −10
Original line number Diff line number Diff line
@@ -2311,16 +2311,6 @@ public abstract class Context {
     */
    public static final String APP_OPS_SERVICE = "appops";

    /**
     * Determine whether the application or calling application has
     * privacy guard. This is a privacy feature intended to permit the user
     * to control access to personal data. Applications and content providers
     * can check this value if they wish to honor privacy guard.
     *
     * @hide
     */
    public abstract boolean isPrivacyGuardEnabled();

    /**
     * Determine whether the given permission is allowed for a particular
     * process and user ID running in the system.
Loading