Snap for 6493843 from cc9f53dd64 to mainline-release
Change-Id: I5acb64b81d593d9e5bfa44389014e711b5ef267e
This commit is contained in:
@@ -546,8 +546,8 @@
|
|||||||
<!-- 10dp start padding for the start icon -->
|
<!-- 10dp start padding for the start icon -->
|
||||||
<item name="titleItemStartPadding">10dp</item>
|
<item name="titleItemStartPadding">10dp</item>
|
||||||
|
|
||||||
<!-- Padding between content and the start icon is 5dp -->
|
<!-- Padding between content and the start icon is 0dp -->
|
||||||
<item name="contentStartPadding">5dp</item>
|
<item name="contentStartPadding">0dp</item>
|
||||||
|
|
||||||
<!-- 0dp start padding for the end item -->
|
<!-- 0dp start padding for the end item -->
|
||||||
<item name="endItemStartPadding">0dp</item>
|
<item name="endItemStartPadding">0dp</item>
|
||||||
@@ -555,8 +555,8 @@
|
|||||||
<item name="endItemEndPadding">24dp</item>
|
<item name="endItemEndPadding">24dp</item>
|
||||||
|
|
||||||
<!-- Align text with slider -->
|
<!-- Align text with slider -->
|
||||||
<item name="titleStartPadding">6dp</item>
|
<item name="titleStartPadding">11dp</item>
|
||||||
<item name="subContentStartPadding">6dp</item>
|
<item name="subContentStartPadding">11dp</item>
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
<style name="DisclaimerPositiveButton" parent="@style/SudGlifButton.Primary">
|
<style name="DisclaimerPositiveButton" parent="@style/SudGlifButton.Primary">
|
||||||
|
|||||||
@@ -16,6 +16,7 @@
|
|||||||
|
|
||||||
package com.android.settings.applications.appinfo;
|
package com.android.settings.applications.appinfo;
|
||||||
|
|
||||||
|
import android.app.Activity;
|
||||||
import android.content.ActivityNotFoundException;
|
import android.content.ActivityNotFoundException;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@@ -123,21 +124,28 @@ public class AppPermissionPreferenceController extends AppInfoPreferenceControll
|
|||||||
|
|
||||||
private void startManagePermissionsActivity() {
|
private void startManagePermissionsActivity() {
|
||||||
// start new activity to manage app permissions
|
// start new activity to manage app permissions
|
||||||
final Intent intent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
|
final Intent permIntent = new Intent(Intent.ACTION_MANAGE_APP_PERMISSIONS);
|
||||||
intent.putExtra(Intent.EXTRA_PACKAGE_NAME, mParent.getAppEntry().info.packageName);
|
permIntent.putExtra(Intent.EXTRA_PACKAGE_NAME, mParent.getAppEntry().info.packageName);
|
||||||
intent.putExtra(EXTRA_HIDE_INFO_BUTTON, true);
|
permIntent.putExtra(EXTRA_HIDE_INFO_BUTTON, true);
|
||||||
String action = mParent.getActivity().getIntent().getAction();
|
Activity activity = mParent.getActivity();
|
||||||
long sessionId = mParent.getActivity().getIntent().getLongExtra(
|
Intent intent = activity != null ? activity.getIntent() : null;
|
||||||
Intent.ACTION_AUTO_REVOKE_PERMISSIONS, INVALID_SESSION_ID);
|
if (intent != null) {
|
||||||
if ((action != null && action.equals(Intent.ACTION_AUTO_REVOKE_PERMISSIONS))
|
String action = intent.getAction();
|
||||||
|| sessionId != INVALID_SESSION_ID) {
|
long sessionId = intent.getLongExtra(
|
||||||
while (sessionId == INVALID_SESSION_ID) {
|
Intent.ACTION_AUTO_REVOKE_PERMISSIONS, INVALID_SESSION_ID);
|
||||||
sessionId = new Random().nextLong();
|
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();
|
||||||
|
}
|
||||||
|
permIntent.putExtra(Intent.ACTION_AUTO_REVOKE_PERMISSIONS, sessionId);
|
||||||
}
|
}
|
||||||
intent.putExtra(Intent.ACTION_AUTO_REVOKE_PERMISSIONS, sessionId);
|
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
mParent.getActivity().startActivityForResult(intent, mParent.SUB_INFO_FRAGMENT);
|
if (activity != null) {
|
||||||
|
activity.startActivityForResult(permIntent, mParent.SUB_INFO_FRAGMENT);
|
||||||
|
}
|
||||||
} catch (ActivityNotFoundException e) {
|
} catch (ActivityNotFoundException e) {
|
||||||
Log.w(TAG, "No app can handle android.intent.action.MANAGE_APP_PERMISSIONS");
|
Log.w(TAG, "No app can handle android.intent.action.MANAGE_APP_PERMISSIONS");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -174,6 +174,15 @@ public class MediaDeviceUpdateWorker extends SliceBackgroundWorker
|
|||||||
return mLocalMediaManager.getSelectedMediaDevice();
|
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) {
|
void adjustSessionVolume(String sessionId, int volume) {
|
||||||
mLocalMediaManager.adjustSessionVolume(sessionId, volume);
|
mLocalMediaManager.adjustSessionVolume(sessionId, volume);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -236,7 +236,7 @@ public class MediaOutputGroupSlice implements CustomSliceable {
|
|||||||
+ ") is unavailable");
|
+ ") is unavailable");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (TextUtils.equals(device.getClientPackageName(), getWorker().getPackageName())) {
|
if (getWorker().isSelectedMediaDevice(device)) {
|
||||||
getWorker().removeDeviceFromPlayMedia(device);
|
getWorker().removeDeviceFromPlayMedia(device);
|
||||||
} else {
|
} else {
|
||||||
getWorker().addDeviceToPlayMedia(device);
|
getWorker().addDeviceToPlayMedia(device);
|
||||||
|
|||||||
@@ -212,11 +212,9 @@ public class MediaOutputGroupSliceTest {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onNotifyChange_sessionOperation_differentClient_verifyAddSession() {
|
public void onNotifyChange_sendSelectableDevice_verifyAddSession() {
|
||||||
mSelectableDevices.add(mDevice1);
|
|
||||||
mSelectableDevices.add(mDevice2);
|
mSelectableDevices.add(mDevice2);
|
||||||
mSelectedDevices.add(mDevice1);
|
mSelectedDevices.add(mDevice1);
|
||||||
when(mDevice2.getClientPackageName()).thenReturn(TEST_PACKAGE_NAME2);
|
|
||||||
when(mLocalMediaManager.getMediaDeviceById(mSelectableDevices, TEST_DEVICE_2_ID))
|
when(mLocalMediaManager.getMediaDeviceById(mSelectableDevices, TEST_DEVICE_2_ID))
|
||||||
.thenReturn(mDevice2);
|
.thenReturn(mDevice2);
|
||||||
sMediaDeviceUpdateWorker.onDeviceListUpdate(mSelectableDevices);
|
sMediaDeviceUpdateWorker.onDeviceListUpdate(mSelectableDevices);
|
||||||
@@ -229,16 +227,13 @@ public class MediaOutputGroupSliceTest {
|
|||||||
|
|
||||||
verify(sMediaDeviceUpdateWorker).addDeviceToPlayMedia(mDevice2);
|
verify(sMediaDeviceUpdateWorker).addDeviceToPlayMedia(mDevice2);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void onNotifyChange_sessionOperation_sameClient_verifyRemoveSession() {
|
public void onNotifyChange_sendSelectedDevice_verifyRemoveSession() {
|
||||||
mSelectableDevices.add(mDevice1);
|
|
||||||
mSelectableDevices.add(mDevice2);
|
|
||||||
mSelectedDevices.add(mDevice1);
|
mSelectedDevices.add(mDevice1);
|
||||||
when(mDevice2.getClientPackageName()).thenReturn(TEST_PACKAGE_NAME);
|
mSelectedDevices.add(mDevice2);
|
||||||
when(mLocalMediaManager.getMediaDeviceById(mSelectableDevices, TEST_DEVICE_2_ID))
|
when(mLocalMediaManager.getMediaDeviceById(mSelectedDevices, TEST_DEVICE_2_ID))
|
||||||
.thenReturn(mDevice2);
|
.thenReturn(mDevice2);
|
||||||
sMediaDeviceUpdateWorker.onDeviceListUpdate(mSelectableDevices);
|
sMediaDeviceUpdateWorker.onDeviceListUpdate(mSelectedDevices);
|
||||||
when(sMediaDeviceUpdateWorker.getSelectedMediaDevice()).thenReturn(mSelectedDevices);
|
when(sMediaDeviceUpdateWorker.getSelectedMediaDevice()).thenReturn(mSelectedDevices);
|
||||||
final Intent intent = new Intent();
|
final Intent intent = new Intent();
|
||||||
intent.putExtra(MEDIA_DEVICE_ID, TEST_DEVICE_2_ID);
|
intent.putExtra(MEDIA_DEVICE_ID, TEST_DEVICE_2_ID);
|
||||||
|
|||||||
Reference in New Issue
Block a user