resolve merge conflicts of c33507d to nyc-mr1-dev-plus-aosp

Change-Id: Id4b3de71842eedd49684b367ed993f44f2f91970
This commit is contained in:
Amith Yamasani
2016-06-08 11:50:57 -07:00
3 changed files with 22 additions and 6 deletions

View File

@@ -169,6 +169,7 @@ package android {
field public static final java.lang.String READ_INSTALL_SESSIONS = "android.permission.READ_INSTALL_SESSIONS";
field public static final java.lang.String READ_LOGS = "android.permission.READ_LOGS";
field public static final java.lang.String READ_NETWORK_USAGE_HISTORY = "android.permission.READ_NETWORK_USAGE_HISTORY";
field public static final java.lang.String READ_OEM_UNLOCK_STATE = "android.permission.READ_OEM_UNLOCK_STATE";
field public static final java.lang.String READ_PHONE_STATE = "android.permission.READ_PHONE_STATE";
field public static final java.lang.String READ_PRIVILEGED_PHONE_STATE = "android.permission.READ_PRIVILEGED_PHONE_STATE";
field public static final java.lang.String READ_SEARCH_INDEXABLES = "android.permission.READ_SEARCH_INDEXABLES";

View File

@@ -1418,6 +1418,11 @@
<permission android:name="android.permission.DVB_DEVICE"
android:protectionLevel="signature|privileged" />
<!-- @SystemApi Allows reading the OEM unlock state
@hide <p>Not for use by third-party applications. -->
<permission android:name="android.permission.READ_OEM_UNLOCK_STATE"
android:protectionLevel="signature|privileged" />
<!-- @hide Allows enabling/disabling OEM unlock
<p>Not for use by third-party applications. -->
<permission android:name="android.permission.OEM_UNLOCK_STATE"

View File

@@ -126,10 +126,20 @@ public class PersistentDataBlockService extends SystemService {
SystemProperties.set(OEM_UNLOCK_PROP, enabled ? "1" : "0");
}
private void enforceOemUnlockPermission() {
private void enforceOemUnlockReadPermission() {
if (mContext.checkCallingOrSelfPermission(Manifest.permission.READ_OEM_UNLOCK_STATE)
== PackageManager.PERMISSION_DENIED
&& mContext.checkCallingOrSelfPermission(Manifest.permission.OEM_UNLOCK_STATE)
== PackageManager.PERMISSION_DENIED) {
throw new SecurityException("Can't access OEM unlock state. Requires "
+ "READ_OEM_UNLOCK_STATE or OEM_UNLOCK_STATE permission.");
}
}
private void enforceOemUnlockWritePermission() {
mContext.enforceCallingOrSelfPermission(
Manifest.permission.OEM_UNLOCK_STATE,
"Can't access OEM unlock state");
"Can't modify OEM unlock state");
}
private void enforceUid(int callingUid) {
@@ -435,7 +445,7 @@ public class PersistentDataBlockService extends SystemService {
@Override
public void wipe() {
enforceOemUnlockPermission();
enforceOemUnlockWritePermission();
synchronized (mLock) {
int ret = nativeWipe(mDataBlockFile);
@@ -453,7 +463,7 @@ public class PersistentDataBlockService extends SystemService {
return;
}
enforceOemUnlockPermission();
enforceOemUnlockWritePermission();
enforceIsAdmin();
// Do not allow oem unlock modification if it has been disallowed.
@@ -472,13 +482,13 @@ public class PersistentDataBlockService extends SystemService {
@Override
public boolean getOemUnlockEnabled() {
enforceOemUnlockPermission();
enforceOemUnlockReadPermission();
return doGetOemUnlockEnabled();
}
@Override
public int getFlashLockState() {
enforceOemUnlockPermission();
enforceOemUnlockReadPermission();
String locked = SystemProperties.get(FLASH_LOCK_PROP);
switch (locked) {
case FLASH_LOCK_LOCKED: