Snap for 6493843 from cc9f53dd64 to mainline-release

Change-Id: I5acb64b81d593d9e5bfa44389014e711b5ef267e
This commit is contained in:
android-build-team Robot
2020-05-14 07:12:05 +00:00
5 changed files with 39 additions and 27 deletions

View File

@@ -546,8 +546,8 @@
<!-- 10dp start padding for the start icon -->
<item name="titleItemStartPadding">10dp</item>
<!-- Padding between content and the start icon is 5dp -->
<item name="contentStartPadding">5dp</item>
<!-- Padding between content and the start icon is 0dp -->
<item name="contentStartPadding">0dp</item>
<!-- 0dp start padding for the end item -->
<item name="endItemStartPadding">0dp</item>
@@ -555,8 +555,8 @@
<item name="endItemEndPadding">24dp</item>
<!-- Align text with slider -->
<item name="titleStartPadding">6dp</item>
<item name="subContentStartPadding">6dp</item>
<item name="titleStartPadding">11dp</item>
<item name="subContentStartPadding">11dp</item>
</style>
<style name="DisclaimerPositiveButton" parent="@style/SudGlifButton.Primary">

View File

@@ -16,6 +16,7 @@
package com.android.settings.applications.appinfo;
import android.app.Activity;
import android.content.ActivityNotFoundException;
import android.content.Context;
import android.content.Intent;
@@ -123,21 +124,28 @@ public class AppPermissionPreferenceController extends AppInfoPreferenceControll
private void startManagePermissionsActivity() {
// start new activity to manage app permissions
final Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, mParent.getAppEntry().info.packageName);
intent.putExtra(EXTRA_HIDE_INFO_BUTTON, true);
String action = mParent.getActivity().getIntent().getAction();
long sessionId = mParent.getActivity().getIntent().getLongExtra(
final Intent permIntent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
permIntent.putExtra(Intent.EXTRA_PACKAGE_NAME, mParent.getAppEntry().info.packageName);
permIntent.putExtra(EXTRA_HIDE_INFO_BUTTON, true);
Activity activity = mParent.getActivity();
Intent intent = activity != null ? activity.getIntent() : null;
if (intent != null) {
String action = intent.getAction();
long sessionId = intent.getLongExtra(
Intent.ACTION_AUTO_REVOKE_PERMISSIONS, INVALID_SESSION_ID);
if ((action != null && action.equals(Intent.ACTION_AUTO_REVOKE_PERMISSIONS))
|| sessionId != INVALID_SESSION_ID) {
// If intent is Auto revoke, and we don't already have a session ID, make one
while (sessionId == INVALID_SESSION_ID) {
sessionId = new Random().nextLong();
}
intent.putExtra(Intent.ACTION_AUTO_REVOKE_PERMISSIONS, sessionId);
permIntent.putExtra(Intent.ACTION_AUTO_REVOKE_PERMISSIONS, sessionId);
}
}
try {
mParent.getActivity().startActivityForResult(intent, mParent.SUB_INFO_FRAGMENT);
if (activity != null) {
activity.startActivityForResult(permIntent, mParent.SUB_INFO_FRAGMENT);
}
} catch (ActivityNotFoundException e) {
Log.w(TAG, "No app can handle android.intent.action.MANAGE_APP_PERMISSIONS");
}

View File

@@ -174,6 +174,15 @@ public class MediaDeviceUpdateWorker extends SliceBackgroundWorker
return mLocalMediaManager.getSelectedMediaDevice();
}
boolean isSelectedMediaDevice(MediaDevice device) {
for (MediaDevice selectedMediaDevice : getSelectedMediaDevice()) {
if (TextUtils.equals(selectedMediaDevice.getId(), device.getId())) {
return true;
}
}
return false;
}
void adjustSessionVolume(String sessionId, int volume) {
mLocalMediaManager.adjustSessionVolume(sessionId, volume);
}

View File

@@ -236,7 +236,7 @@ public class MediaOutputGroupSlice implements CustomSliceable {
+ ") is unavailable");
return;
}
if (TextUtils.equals(device.getClientPackageName(), getWorker().getPackageName())) {
if (getWorker().isSelectedMediaDevice(device)) {
getWorker().removeDeviceFromPlayMedia(device);
} else {
getWorker().addDeviceToPlayMedia(device);

View File

@@ -212,11 +212,9 @@ public class MediaOutputGroupSliceTest {
}
@Test
public void onNotifyChange_sessionOperation_differentClient_verifyAddSession() {
mSelectableDevices.add(mDevice1);
public void onNotifyChange_sendSelectableDevice_verifyAddSession() {
mSelectableDevices.add(mDevice2);
mSelectedDevices.add(mDevice1);
when(mDevice2.getClientPackageName()).thenReturn(TEST_PACKAGE_NAME2);
when(mLocalMediaManager.getMediaDeviceById(mSelectableDevices, TEST_DEVICE_2_ID))
.thenReturn(mDevice2);
sMediaDeviceUpdateWorker.onDeviceListUpdate(mSelectableDevices);
@@ -229,16 +227,13 @@ public class MediaOutputGroupSliceTest {
verify(sMediaDeviceUpdateWorker).addDeviceToPlayMedia(mDevice2);
}
@Test
public void onNotifyChange_sessionOperation_sameClient_verifyRemoveSession() {
mSelectableDevices.add(mDevice1);
mSelectableDevices.add(mDevice2);
public void onNotifyChange_sendSelectedDevice_verifyRemoveSession() {
mSelectedDevices.add(mDevice1);
when(mDevice2.getClientPackageName()).thenReturn(TEST_PACKAGE_NAME);
when(mLocalMediaManager.getMediaDeviceById(mSelectableDevices, TEST_DEVICE_2_ID))
mSelectedDevices.add(mDevice2);
when(mLocalMediaManager.getMediaDeviceById(mSelectedDevices, TEST_DEVICE_2_ID))
.thenReturn(mDevice2);
sMediaDeviceUpdateWorker.onDeviceListUpdate(mSelectableDevices);
sMediaDeviceUpdateWorker.onDeviceListUpdate(mSelectedDevices);
when(sMediaDeviceUpdateWorker.getSelectedMediaDevice()).thenReturn(mSelectedDevices);
final Intent intent = new Intent();
intent.putExtra(MEDIA_DEVICE_ID, TEST_DEVICE_2_ID);