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

Commit e96bf23f authored by Sam Mortimer's avatar Sam Mortimer Committed by Steve Kondik
Browse files

[1/2] frameworks/base: Privacy Guard

PS2: * add missing call to updatePrivacyGuardNotificationLocked()
     * remove ic_privacy_guard and ic_privacy_guard_off
     * use stat_notify_privacy_guard drawable from Björn
     * rebase

PS3: * exclude MODE_IGNORED from causing
       getPrivacyGuardSettingForPackage() returning true.
       multiuser restrictions on calls/sms otherwise
       cause privacyguard to appear to be on when really
       it isn't.
     * rebase

Pulled together from:

Author: Danesh M <daneshm90@gmail.com>
Date:   Thu Sep 5 19:23:15 2013 -0700
Privacy Guard : Reimplement backed by AppOps
Re-implements privacy guard to use appops.
Change-Id: I2b52e8cf0d6e126fb156f83df885b5551503cd9d

Author: Jorge Ruesga <jorge@ruesga.com>
Date:   Sat Jan 4 01:34:39 2014 +0100
privacyguard: Share privacy package name between activity stacks
AOSP 4.4 now has a stack supervisor with differents activity stacks for home and focus activities.
Every ActivityStack instance has a ref to this supervisor. Just share the privacy guard package name
throught the supervisor.
Patchset 2: Fix formatting
Change-Id: I5dd75cfa7f5e8b568a4302fce98809ae307c6d52
JIRA: CYAN-2874
Issue: https://jira.cyanogenmod.org/browse/CYAN-2874

Author: Steve Kondik <shade@chemlab.org>
Date:   Sun Feb 23 19:23:31 2014 +0100
Use MODE_ASK as the default ops mode in Privacy Guard
* Prompting the user is far more useful as a default behavior. The
  choice will be remembered after the first request.
Change-Id: Ie62f932047f8b761bd0dd9f836bcd1132062edf5

Author: Steve Kondik <shade@chemlab.org>
Date:   Tue Feb 25 13:11:12 2014 +0100
Relocate and cleanup new app ops features and PGify it
Change-Id: I4eb65f6f88c2f2aecdf054ffd52c31c4d5866900

Change-Id: I2a69d59f288630fefcc83e6109ab608fa28eb71b
parent b2aac59c
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
@@ -1897,4 +1897,23 @@ public class AppOpsManager {
        }
        return isShow;
    }

    /** @hide */
    public boolean getPrivacyGuardSettingForPackage(int uid, String packageName) {
        try {
            return mService.getPrivacyGuardSettingForPackage(uid, packageName);
        } catch (RemoteException e) {
        }
        return false;
    }

    /** @hide */
    public void setPrivacyGuardSettingForPackage(int uid, String packageName,
            boolean state) {
        try {
            mService.setPrivacyGuardSettingForPackage(uid, packageName, state);
        } catch (RemoteException e) {
        }
    }

}
+8 −1
Original line number Diff line number Diff line
@@ -5113,6 +5113,12 @@ public final class Settings {
         */
        public static final String PROTECTED_COMPONENTS = "protected_components";

        /**
         * Whether newly installed apps should run with privacy guard by default
         * @hide
         */
        public static final String PRIVACY_GUARD_DEFAULT = "privacy_guard_default";

        /**
         * This are the settings to be backed up.
         *
@@ -5163,7 +5169,8 @@ public final class Settings {
            MOUNT_UMS_PROMPT,
            MOUNT_UMS_NOTIFY_ENABLED,
            UI_NIGHT_MODE,
            SLEEP_TIMEOUT
            SLEEP_TIMEOUT,
            PRIVACY_GUARD_DEFAULT
        };

        /**
+4 −0
Original line number Diff line number Diff line
@@ -43,4 +43,8 @@ interface IAppOpsService {
    void setUserRestrictions(in Bundle restrictions, int userHandle);
    void removeUser(int userHandle);
    boolean isControlAllowed(int code, String packageName);

    // Privacy guard methods
    boolean getPrivacyGuardSettingForPackage(int uid, String packageName);
    void setPrivacyGuardSettingForPackage(int uid, String packageName, boolean state);
}
+11 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
    android:width="26dp"
    android:height="24dp"
    android:viewportWidth="26"
    android:viewportHeight="24">

    <path
        android:pathData="M11.999,11.488c0.017,0.148,0.013,0.301-0.017,0.455c-0.155,0.804-0.932,1.33-1.736,1.175 c-0.804-0.155-1.33-0.933-1.175-1.736c0.03-0.154,0.083-0.297,0.154-0.428L11.999,11.488Z M16.775,10.953l-2.774,0.535  c-0.017,0.148-0.013,0.301,0.017,0.455c0.155,0.804,0.932,1.33,1.736,1.175c0.804-0.155,1.33-0.933,1.175-1.736  C16.899,11.228,16.846,11.084,16.775,10.953z M21.539,8.978c-0.132,2.629-0.803,5.264-2.162,7.534  c-1.186,1.991-2.889,3.675-4.905,4.82c-0.459,0.259-0.932,0.494-1.427,0.676c-0.061,0.029-0.122-0.014-0.18-0.032 c-1.047-0.415-2.019-1.006-2.909-1.693c-1.807-1.397-3.239-3.263-4.151-5.356c-0.725-1.651-1.137-3.429-1.297-5.222 C4.33,7.77,4.442,5.816,4.73,3.896c0.601,0.053,1.207,0.031,1.807-0.017c1.309-0.115,2.596-0.41,3.849-0.799 c0.888-0.283,1.766-0.604,2.611-0.999c1.13,0.523,2.311,0.935,3.512,1.26c1.549,0.412,3.157,0.666,4.763,0.562 c0.116,0.846,0.216,1.695,0.261,2.548c0.002,0.241,0.042,0.481,0.037,0.723C21.574,7.776,21.594,8.379,21.539,8.978z M17.957,10.132  c0-0.787-0.345-1.322-1.002-1.675V6.396c0-0.179-0.145-0.324-0.324-0.324c-0.179,0-0.324,0.145-0.324,0.324v1.799 c-0.821-0.248-1.933-0.34-3.307-0.34V7.86h0V7.856c-0.155,0-0.305,0.002-0.453,0.004h-0.001c-1.075,0.018-1.973,0.101-2.677,0.286 v-1.75c0-0.179-0.145-0.324-0.324-0.324c-0.179,0-0.324,0.145-0.324,0.324v1.975C8.449,8.72,8.043,9.277,8.043,10.132v1.943v0.504 v0.554c0,1.702,1.613,2.225,4.503,2.272v0.003h0.179c0.09,0.001,0.182,0.001,0.275,0.001v-0.001h0v0.001 c0.093,0,0.184-0.001,0.275-0.001h0.013c2.995-0.03,4.67-0.54,4.67-2.275v-0.554v-0.504V10.132z"
        android:fillColor="#FFFFFFFF" />
</vector>
+9 −0
Original line number Diff line number Diff line
@@ -58,4 +58,13 @@
    <string name="permlab_changePhoneBlacklist">change phone blacklist</string>
    <!-- [CHAR LIMIT=NONE] Description of an application permission, listed so the user can choose whether they want to allow the application to do this. -->
    <string name="permdesc_changePhoneBlacklist">Allows an app to change the phone numbers that are blocked for incoming calls or messages.</string>

    <!-- Privacy Guard -->
    <string name="permlab_changePrivacyGuardState">enable or disable Privacy Guard</string>
    <string name="permdesc_changePrivacyGuardState">Allows the app to change whether another app runs with Privacy Guard. When an app is running with Privacy Guard, it will not have access to personal data such as contacts, call logs, or messages.</string>
    <string name="privacy_guard_notification">Privacy Guard active</string>
    <string name="privacy_guard_notification_detail"><xliff:g id="app">%1$s</xliff:g> will not be able to access personal data</string>
    <string name="privacy_guard_dialog_title">Privacy Guard</string>
    <string name="privacy_guard_dialog_summary"><xliff:g id="app">%1$s</xliff:g> would like to <xliff:g id="op">%2$s</xliff:g>.</string>

</resources>
Loading