Snap for 5524043 from e31b34fa0c to pi-platform-release

Change-Id: Ic11e8de9f8384ee039c536f67febaa56e9a3a673
This commit is contained in:
android-build-team Robot
2019-06-05 02:03:22 +00:00
5 changed files with 71 additions and 0 deletions

View File

@@ -122,6 +122,8 @@ message Atom {
WTFOccurred wtf_occurred = 80;
LowMemReported low_mem_reported = 81;
ThermalThrottlingStateChanged thermal_throttling = 86;
// 86 - 165 are not available
BluetoothClassicPairingEventReported bluetooth_classic_pairing_event_reported = 166;
}
// Pulled events will start at field 10000.
@@ -1026,6 +1028,42 @@ message BluetoothConnectionStateChanged {
optional int32 bt_profile = 3;
}
/**
* Logs there is an event related Bluetooth classic pairing
*
* Logged from:
* system/bt
*/
message BluetoothClassicPairingEventReported {
// An identifier that can be used to match events for this device.
// Currently, this is a salted hash of the MAC address of this Bluetooth device.
// Salt: Randomly generated 256 bit value
// Hash algorithm: HMAC-SHA256
// Size: 32 byte
// Default: null or empty if the device identifier is not known
// Note: string is here for backward compatibility purpose only
optional string obfuscated_id = 1;
// Connection handle of this connection if available
// Range: 0x0000 - 0x0EFF (12 bits)
// Default: 0xFFFF if the handle is unknown
optional int32 connection_handle = 2;
// HCI command associated with this event
// Default: CMD_UNKNOWN
optional int32 hci_cmd = 3;
// HCI event associated with this event
// Default: EVT_UNKNOWN
optional int32 hci_event = 4;
// HCI command status code if this is triggered by hci_cmd
// Default: STATUS_UNKNOWN
optional int32 cmd_status = 5;
// HCI reason code associated with this event
// Default: STATUS_UNKNOWN
optional int32 reason_code = 6;
// A status value related to this specific event
// Default: 0
optional int64 event_value = 7;
}
/**
* Logs when something is plugged into or removed from the USB-C connector.
*

View File

@@ -2186,6 +2186,11 @@ public class NotificationManagerService extends SystemService {
@Override
public boolean areNotificationsEnabledForPackage(String pkg, int uid) {
checkCallerIsSystemOrSameApp(pkg);
if (UserHandle.getCallingUserId() != UserHandle.getUserId(uid)) {
getContext().enforceCallingPermission(
android.Manifest.permission.INTERACT_ACROSS_USERS,
"canNotifyAsPackage for uid " + uid);
}
return mRankingHelper.getImportance(pkg, uid) != IMPORTANCE_NONE;
}

View File

@@ -18141,6 +18141,12 @@ public class PackageManagerService extends IPackageManager.Stub
@Override
public boolean isPackageDeviceAdminOnAnyUser(String packageName) {
final int callingUid = Binder.getCallingUid();
if (checkUidPermission(android.Manifest.permission.MANAGE_USERS, callingUid)
!= PERMISSION_GRANTED) {
EventLog.writeEvent(0x534e4554, "128599183", -1, "");
throw new SecurityException(android.Manifest.permission.MANAGE_USERS
+ " permission is required to call this API");
}
if (getInstantAppPackageName(callingUid) != null
&& !isCallerSameApp(packageName, callingUid)) {
return false;

View File

@@ -3930,6 +3930,9 @@ public class DevicePolicyManagerService extends BaseIDevicePolicyManager {
@Override
public boolean isSeparateProfileChallengeAllowed(int userHandle) {
if (!isCallerWithSystemUid()) {
throw new SecurityException("Caller must be system");
}
ComponentName profileOwner = getProfileOwner(userHandle);
// Profile challenge is supported on N or newer release.
return profileOwner != null &&

View File

@@ -34,6 +34,7 @@ import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_SCREEN_ON
import static android.app.NotificationManager.Policy.SUPPRESSED_EFFECT_STATUS_BAR;
import static android.content.pm.PackageManager.FEATURE_WATCH;
import static android.content.pm.PackageManager.PERMISSION_DENIED;
import static android.content.pm.PackageManager.PERMISSION_GRANTED;
import static android.os.Build.VERSION_CODES.O_MR1;
import static android.os.Build.VERSION_CODES.P;
@@ -106,6 +107,7 @@ import android.testing.AndroidTestingRunner;
import android.testing.TestableContext;
import android.testing.TestableLooper;
import android.testing.TestableLooper.RunWithLooper;
import android.testing.TestablePermissions;
import android.text.Html;
import android.util.ArrayMap;
import android.util.AtomicFile;
@@ -3145,4 +3147,21 @@ public class NotificationManagerServiceTest extends UiServiceTestCase {
assertEquals(0, captor.getValue().getNotification().flags);
}
@Test
public void testAreNotificationsEnabledForPackage_crossUser() throws Exception {
try {
mBinderService.areNotificationsEnabledForPackage(mContext.getPackageName(),
mUid + UserHandle.PER_USER_RANGE);
fail("Cannot call cross user without permission");
} catch (SecurityException e) {
// pass
}
// cross user, with permission, no problem
TestablePermissions perms = mContext.getTestablePermissions();
perms.setPermission(android.Manifest.permission.INTERACT_ACROSS_USERS, PERMISSION_GRANTED);
mBinderService.areNotificationsEnabledForPackage(mContext.getPackageName(),
mUid + UserHandle.PER_USER_RANGE);
}
}