am f62f4c94: Merge "Bug: 21589105 Rescoping the SYSTEM_ALERT_WINDOW permission to an explicit toggle to be manually enabled in Settings." into mnc-dev
* commit 'f62f4c94a36f5c2f7ad3c70316dc585ea3fd721a': Bug: 21589105 Rescoping the SYSTEM_ALERT_WINDOW permission to an explicit toggle to be manually enabled in Settings.
This commit is contained in:
@@ -26424,6 +26424,7 @@ package android.provider {
|
||||
field public static final java.lang.String ACTION_LOCATION_SOURCE_SETTINGS = "android.settings.LOCATION_SOURCE_SETTINGS";
|
||||
field public static final java.lang.String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS = "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
|
||||
field public static final java.lang.String ACTION_MANAGE_APPLICATIONS_SETTINGS = "android.settings.MANAGE_APPLICATIONS_SETTINGS";
|
||||
field public static final java.lang.String ACTION_MANAGE_OVERLAY_PERMISSION = "android.settings.MANAGE_OVERLAY_PERMISSION";
|
||||
field public static final java.lang.String ACTION_MEMORY_CARD_SETTINGS = "android.settings.MEMORY_CARD_SETTINGS";
|
||||
field public static final java.lang.String ACTION_NETWORK_OPERATOR_SETTINGS = "android.settings.NETWORK_OPERATOR_SETTINGS";
|
||||
field public static final java.lang.String ACTION_NFCSHARING_SETTINGS = "android.settings.NFCSHARING_SETTINGS";
|
||||
|
||||
@@ -28485,6 +28485,7 @@ package android.provider {
|
||||
field public static final java.lang.String ACTION_LOCATION_SOURCE_SETTINGS = "android.settings.LOCATION_SOURCE_SETTINGS";
|
||||
field public static final java.lang.String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS = "android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
|
||||
field public static final java.lang.String ACTION_MANAGE_APPLICATIONS_SETTINGS = "android.settings.MANAGE_APPLICATIONS_SETTINGS";
|
||||
field public static final java.lang.String ACTION_MANAGE_OVERLAY_PERMISSION = "android.settings.MANAGE_OVERLAY_PERMISSION";
|
||||
field public static final java.lang.String ACTION_MEMORY_CARD_SETTINGS = "android.settings.MEMORY_CARD_SETTINGS";
|
||||
field public static final java.lang.String ACTION_NETWORK_OPERATOR_SETTINGS = "android.settings.NETWORK_OPERATOR_SETTINGS";
|
||||
field public static final java.lang.String ACTION_NFCSHARING_SETTINGS = "android.settings.NFCSHARING_SETTINGS";
|
||||
|
||||
@@ -561,6 +561,21 @@ public final class Settings {
|
||||
public static final String ACTION_MANAGE_ALL_APPLICATIONS_SETTINGS =
|
||||
"android.settings.MANAGE_ALL_APPLICATIONS_SETTINGS";
|
||||
|
||||
/**
|
||||
* Activity Action: Show settings to toggle permission to draw on top of
|
||||
* other apps.
|
||||
* <p>
|
||||
* In some cases, a matching Activity may not exist, so ensure you
|
||||
* safeguard against this.
|
||||
* <p>
|
||||
* Input: Nothing.
|
||||
* <p>
|
||||
* Output: Nothing.
|
||||
*/
|
||||
@SdkConstant(SdkConstantType.ACTIVITY_INTENT_ACTION)
|
||||
public static final String ACTION_MANAGE_OVERLAY_PERMISSION =
|
||||
"android.settings.MANAGE_OVERLAY_PERMISSION";
|
||||
|
||||
/**
|
||||
* Activity Action: Show screen of details about a particular application.
|
||||
* <p>
|
||||
|
||||
@@ -40,6 +40,7 @@ public class MetricsLogger implements MetricsConstants {
|
||||
public static final int ACTION_BRIGHTNESS = 218;
|
||||
public static final int ACTION_BRIGHTNESS_AUTO = 219;
|
||||
public static final int BRIGHTNESS_DIALOG = 220;
|
||||
public static final int SYSTEM_ALERT_WINDOW_APPS = 221;
|
||||
// Temporary constants go here, to await migration to MetricsConstants.
|
||||
|
||||
public static void visible(Context context, int category) throws IllegalArgumentException {
|
||||
|
||||
@@ -1414,7 +1414,7 @@
|
||||
<permission android:name="android.permission.SYSTEM_ALERT_WINDOW"
|
||||
android:label="@string/permlab_systemAlertWindow"
|
||||
android:description="@string/permdesc_systemAlertWindow"
|
||||
android:protectionLevel="dangerous" />
|
||||
android:protectionLevel="signature|system|appop" />
|
||||
|
||||
<!-- ================================== -->
|
||||
<!-- Permissions affecting the system wallpaper -->
|
||||
|
||||
@@ -51,6 +51,7 @@ import android.media.IAudioService;
|
||||
import android.media.Ringtone;
|
||||
import android.media.RingtoneManager;
|
||||
import android.media.session.MediaSessionLegacyHelper;
|
||||
import android.os.Binder;
|
||||
import android.os.Bundle;
|
||||
import android.os.Debug;
|
||||
import android.os.FactoryTest;
|
||||
@@ -61,6 +62,7 @@ import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Messenger;
|
||||
import android.os.PowerManager;
|
||||
import android.os.Process;
|
||||
import android.os.RemoteException;
|
||||
import android.os.ServiceManager;
|
||||
import android.os.SystemClock;
|
||||
@@ -267,6 +269,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
SearchManager mSearchManager;
|
||||
AccessibilityManager mAccessibilityManager;
|
||||
BurnInProtectionHelper mBurnInProtectionHelper;
|
||||
AppOpsManager mAppOpsManager;
|
||||
|
||||
// Vibrator pattern for haptic feedback of a long press.
|
||||
long[] mLongPressVibePattern;
|
||||
@@ -1255,6 +1258,7 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
mWindowManagerInternal = LocalServices.getService(WindowManagerInternal.class);
|
||||
mActivityManagerInternal = LocalServices.getService(ActivityManagerInternal.class);
|
||||
mDreamManagerInternal = LocalServices.getService(DreamManagerInternal.class);
|
||||
mAppOpsManager = (AppOpsManager) mContext.getSystemService(Context.APP_OPS_SERVICE);
|
||||
|
||||
// Init display burn-in protection
|
||||
boolean burnInProtectionEnabled = context.getResources().getBoolean(
|
||||
@@ -1812,6 +1816,25 @@ public class PhoneWindowManager implements WindowManagerPolicy {
|
||||
permission = android.Manifest.permission.INTERNAL_SYSTEM_WINDOW;
|
||||
}
|
||||
if (permission != null) {
|
||||
if (permission == android.Manifest.permission.SYSTEM_ALERT_WINDOW) {
|
||||
final int callingUid = Binder.getCallingUid();
|
||||
// check if this is a system uid first before bothering with
|
||||
// obtaining package name
|
||||
if (callingUid == Process.SYSTEM_UID) {
|
||||
return WindowManagerGlobal.ADD_OKAY;
|
||||
}
|
||||
|
||||
final int mode = mAppOpsManager.checkOp(outAppOp[0], callingUid,
|
||||
attrs.packageName);
|
||||
if (mode == AppOpsManager.MODE_DEFAULT) {
|
||||
if (mContext.checkCallingPermission(permission) !=
|
||||
PackageManager.PERMISSION_GRANTED) {
|
||||
return WindowManagerGlobal.ADD_PERMISSION_DENIED;
|
||||
}
|
||||
}
|
||||
return WindowManagerGlobal.ADD_OKAY;
|
||||
}
|
||||
|
||||
if (mContext.checkCallingOrSelfPermission(permission)
|
||||
!= PackageManager.PERMISSION_GRANTED) {
|
||||
return WindowManagerGlobal.ADD_PERMISSION_DENIED;
|
||||
|
||||
Reference in New Issue
Block a user