Snap for 6504394 from e0395188f5 to mainline-release
Change-Id: I74f29eb87ef6977b5549ac3877b351816afa63c6
This commit is contained in:
@@ -4689,7 +4689,7 @@
|
||||
<!-- Title for the 'virtual keyboard' preference sub-screen. [CHAR LIMIT=35] -->
|
||||
<string name="virtual_keyboard_category">On-screen keyboard</string>
|
||||
<!-- Title for the 'available virtual keyboard' preference sub-screen. [CHAR LIMIT=35] -->
|
||||
<string name="available_virtual_keyboard_category">Available virtual keyboard</string>
|
||||
<string name="available_virtual_keyboard_category">Available On-screen keyboard</string>
|
||||
<!-- Title for the button to trigger the 'Manage keyboards' preference sub-screen, where the user can turn on/off installed virtual keyboards.[CHAR LIMIT=35] -->
|
||||
<string name="add_virtual_keyboard">Manage on-screen keyboards</string>
|
||||
<!-- Title for the 'keyboard assistance' preference category. [CHAR LIMIT=35] -->
|
||||
@@ -4707,7 +4707,7 @@
|
||||
<!-- Title for the 'Work profile keyboards & tools' preference category inside Languages and inputs'. [CHAR LIMIT=50] -->
|
||||
<string name="language_and_input_for_work_category_title">Work profile keyboards & tools</string>
|
||||
<!-- Title for the 'Virtual keyboards for work' preference. [CHAR LIMIT=45] -->
|
||||
<string name="virtual_keyboards_for_work_title">Virtual keyboard for work</string>
|
||||
<string name="virtual_keyboards_for_work_title">On-screen keyboard for work</string>
|
||||
|
||||
<!-- Summary text for keyboards when no layout has been selected. [CHAR LIMIT=35] -->
|
||||
<string name="default_keyboard_layout">Default</string>
|
||||
|
||||
@@ -25,7 +25,8 @@
|
||||
<com.android.settings.widget.GearPreference
|
||||
android:key="default_assist"
|
||||
android:title="@string/default_digital_assistant_title"
|
||||
android:summary="@string/summary_placeholder" />
|
||||
android:summary="@string/summary_placeholder"
|
||||
settings:searchable="false"/>
|
||||
|
||||
<Preference
|
||||
android:key="gesture_assist_application"
|
||||
|
||||
@@ -19,6 +19,7 @@
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="zen_mode_calls_settings_page"
|
||||
settings:searchable="false"
|
||||
android:title="@string/zen_mode_calls_title">
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
@@ -17,7 +17,9 @@
|
||||
|
||||
<PreferenceScreen
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:settings="http://schemas.android.com/apk/res-auto"
|
||||
android:key="zen_mode_messages_settings_page"
|
||||
settings:searchable="false"
|
||||
android:title="@string/zen_mode_messages_title" >
|
||||
|
||||
<PreferenceCategory
|
||||
|
||||
@@ -123,12 +123,12 @@ public class CaptionPropertiesFragment extends SettingsPreferenceFragment
|
||||
|
||||
private CharSequence geTextAppearanceSummary(Context context) {
|
||||
final String[] fontSizeSummaries = context.getResources().getStringArray(
|
||||
R.array.captioning_font_size_selector_titles);
|
||||
R.array.captioning_font_size_selector_summaries);
|
||||
|
||||
final float fontSize = mCaptioningManager.getFontScale();
|
||||
final int idx = Floats.indexOf(mFontSizeValuesArray, fontSize);
|
||||
final String fontSizeSummary = fontSizeSummaries[idx == /* not exist */ -1 ? 0 : idx];
|
||||
return context.getString(R.string.captioning_caption_appearance_summary, fontSizeSummary);
|
||||
|
||||
return fontSizeSummaries[idx == /* not exist */ -1 ? 0 : idx];
|
||||
}
|
||||
|
||||
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
|
||||
|
||||
@@ -120,18 +120,10 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
|
||||
if (!mCrossProfileApps.canConfigureInteractAcrossProfiles(mPackageName)) {
|
||||
logNonConfigurableAppMetrics();
|
||||
}
|
||||
Bundle bundle = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGS);
|
||||
if (bundle == null) {
|
||||
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_LAUNCHED_FROM_SETTINGS);
|
||||
return;
|
||||
}
|
||||
Intent intent = (Intent) bundle.get(INTENT_KEY);
|
||||
if (intent == null) {
|
||||
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_LAUNCHED_FROM_SETTINGS);
|
||||
return;
|
||||
}
|
||||
if (ACTION_MANAGE_CROSS_PROFILE_ACCESS.equals(intent.getAction())) {
|
||||
if (launchedByApp()) {
|
||||
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_LAUNCHED_FROM_APP);
|
||||
} else {
|
||||
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_LAUNCHED_FROM_SETTINGS);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -270,6 +262,9 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
|
||||
logEvent(DevicePolicyEnums.CROSS_PROFILE_SETTINGS_PAGE_USER_CONSENTED);
|
||||
enableInteractAcrossProfiles(true);
|
||||
refreshUi();
|
||||
if (launchedByApp()) {
|
||||
setIntentAndFinish(/* appChanged= */ true);
|
||||
}
|
||||
}
|
||||
})
|
||||
.setNegativeButton(R.string.deny, new DialogInterface.OnClickListener() {
|
||||
@@ -464,4 +459,16 @@ public class InteractAcrossProfilesDetails extends AppInfoBase
|
||||
public int getMetricsCategory() {
|
||||
return SettingsEnums.INTERACT_ACROSS_PROFILES;
|
||||
}
|
||||
|
||||
private boolean launchedByApp() {
|
||||
final Bundle bundle = getIntent().getBundleExtra(EXTRA_SHOW_FRAGMENT_ARGS);
|
||||
if (bundle == null) {
|
||||
return false;
|
||||
}
|
||||
final Intent intent = (Intent) bundle.get(INTENT_KEY);
|
||||
if (intent == null) {
|
||||
return false;
|
||||
}
|
||||
return ACTION_MANAGE_CROSS_PROFILE_ACCESS.equals(intent.getAction());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -618,12 +618,7 @@ public class StorageSettings extends SettingsPreferenceFragment implements Index
|
||||
data.title = context.getString(R.string.storage_menu_free);
|
||||
data.key = KEY_STORAGE_SETTINGS_FREE_SPACE;
|
||||
data.screenTitle = context.getString(R.string.storage_menu_free);
|
||||
// We need to define all three in order for this to trigger properly.
|
||||
data.intentAction = StorageManager.ACTION_MANAGE_STORAGE;
|
||||
data.intentTargetPackage =
|
||||
context.getString(R.string.config_deletion_helper_package);
|
||||
data.intentTargetClass =
|
||||
context.getString(R.string.config_deletion_helper_class);
|
||||
result.add(data);
|
||||
|
||||
return result;
|
||||
|
||||
@@ -73,7 +73,8 @@ public class MediaDeviceUpdateWorker extends SliceBackgroundWorker
|
||||
protected void onSlicePinned() {
|
||||
mMediaDevices.clear();
|
||||
mIsTouched = false;
|
||||
if (mLocalMediaManager == null) {
|
||||
if (mLocalMediaManager == null || !TextUtils.equals(mPackageName,
|
||||
mLocalMediaManager.getPackageName())) {
|
||||
mLocalMediaManager = new LocalMediaManager(mContext, mPackageName, null);
|
||||
}
|
||||
|
||||
|
||||
@@ -81,14 +81,17 @@ public class MediaOutputIndicatorWorker extends SliceBackgroundWorker implements
|
||||
mContext.registerReceiver(mReceiver, intentFilter);
|
||||
mLocalBluetoothManager.getEventManager().registerCallback(this);
|
||||
|
||||
if (mLocalMediaManager == null) {
|
||||
final MediaController controller = getActiveLocalMediaController();
|
||||
if (controller != null) {
|
||||
mPackageName = controller.getPackageName();
|
||||
}
|
||||
mLocalMediaManager = new LocalMediaManager(mContext, mPackageName, null);
|
||||
final MediaController controller = getActiveLocalMediaController();
|
||||
if (controller == null) {
|
||||
mPackageName = null;
|
||||
} else {
|
||||
mPackageName = controller.getPackageName();
|
||||
}
|
||||
if (mLocalMediaManager == null || !TextUtils.equals(mPackageName,
|
||||
mLocalMediaManager.getPackageName())) {
|
||||
mLocalMediaManager = new LocalMediaManager(mContext, mPackageName,
|
||||
null /* notification */);
|
||||
}
|
||||
|
||||
mLocalMediaManager.registerCallback(this);
|
||||
mLocalMediaManager.startScan();
|
||||
}
|
||||
|
||||
@@ -35,12 +35,17 @@ import android.media.RoutingSessionInfo;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.android.settings.testutils.shadow.ShadowAudioManager;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothAdapter;
|
||||
import com.android.settings.testutils.shadow.ShadowBluetoothUtils;
|
||||
import com.android.settingslib.bluetooth.BluetoothEventManager;
|
||||
import com.android.settingslib.bluetooth.LocalBluetoothManager;
|
||||
import com.android.settingslib.media.LocalMediaManager;
|
||||
import com.android.settingslib.media.MediaDevice;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
import org.robolectric.RobolectricTestRunner;
|
||||
import org.robolectric.RuntimeEnvironment;
|
||||
@@ -51,16 +56,28 @@ import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@RunWith(RobolectricTestRunner.class)
|
||||
@Config(shadows = ShadowAudioManager.class)
|
||||
@Config(shadows = {ShadowAudioManager.class, ShadowBluetoothAdapter.class,
|
||||
ShadowBluetoothUtils.class})
|
||||
public class MediaDeviceUpdateWorkerTest {
|
||||
|
||||
private static final Uri URI = Uri.parse("content://com.android.settings.slices/test");
|
||||
private static final Uri URI1 = Uri.parse("content://com.android.settings.slices/action/"
|
||||
+ "media_output?media_package_name=com.music1");
|
||||
private static final Uri URI2 = Uri.parse("content://com.android.settings.slices/action/"
|
||||
+ "media_output?media_package_name=com.music2");
|
||||
private static final String TEST_DEVICE_PACKAGE_NAME1 = "com.music1";
|
||||
private static final String TEST_DEVICE_PACKAGE_NAME2 = "com.music2";
|
||||
private static final String TEST_DEVICE_1_ID = "test_device_1_id";
|
||||
private static final String TEST_DEVICE_2_ID = "test_device_2_id";
|
||||
private static final String TEST_DEVICE_3_ID = "test_device_3_id";
|
||||
|
||||
private final List<MediaDevice> mMediaDevices = new ArrayList<>();
|
||||
|
||||
@Mock
|
||||
private LocalBluetoothManager mLocalBluetoothManager;
|
||||
@Mock
|
||||
private BluetoothEventManager mBluetoothEventManager;
|
||||
|
||||
private MediaDeviceUpdateWorker mMediaDeviceUpdateWorker;
|
||||
private ContentResolver mResolver;
|
||||
private Context mContext;
|
||||
@@ -209,4 +226,21 @@ public class MediaDeviceUpdateWorkerTest {
|
||||
assertThat(mMediaDeviceUpdateWorker.getActiveRemoteMediaDevice()).containsExactly(
|
||||
remoteSessionInfo);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSlicePinned_packageUpdated_checkPackageName() {
|
||||
ShadowBluetoothUtils.sLocalBluetoothManager = mLocalBluetoothManager;
|
||||
when(mLocalBluetoothManager.getEventManager()).thenReturn(mBluetoothEventManager);
|
||||
mMediaDeviceUpdateWorker = new MediaDeviceUpdateWorker(mContext, URI1);
|
||||
mMediaDeviceUpdateWorker.onSlicePinned();
|
||||
|
||||
assertThat(mMediaDeviceUpdateWorker.mLocalMediaManager.getPackageName()).matches(
|
||||
TEST_DEVICE_PACKAGE_NAME1);
|
||||
|
||||
mMediaDeviceUpdateWorker = new MediaDeviceUpdateWorker(mContext, URI2);
|
||||
mMediaDeviceUpdateWorker.onSlicePinned();
|
||||
|
||||
assertThat(mMediaDeviceUpdateWorker.mLocalMediaManager.getPackageName()).matches(
|
||||
TEST_DEVICE_PACKAGE_NAME2);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,6 +62,8 @@ import java.util.List;
|
||||
@Config(shadows = {ShadowBluetoothAdapter.class, ShadowBluetoothUtils.class})
|
||||
public class MediaOutputIndicatorWorkerTest {
|
||||
private static final Uri URI = Uri.parse("content://com.android.settings.slices/test");
|
||||
private static final String TEST_PACKAGE_NAME = "com.android.test";
|
||||
private static final String TEST_PACKAGE_NAME2 = "com.android.test2";
|
||||
|
||||
@Mock
|
||||
private BluetoothEventManager mBluetoothEventManager;
|
||||
@@ -109,6 +111,33 @@ public class MediaOutputIndicatorWorkerTest {
|
||||
verify(mLocalMediaManager).startScan();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSlicePinned_packageUpdated_checkPackageName() {
|
||||
initPlayback();
|
||||
when(mMediaController.getPlaybackInfo()).thenReturn(mPlaybackInfo);
|
||||
when(mMediaController.getPlaybackState()).thenReturn(mPlaybackState);
|
||||
when(mMediaController.getPackageName()).thenReturn(TEST_PACKAGE_NAME);
|
||||
|
||||
mMediaOutputIndicatorWorker.onSlicePinned();
|
||||
assertThat(mMediaOutputIndicatorWorker.mLocalMediaManager.getPackageName()).matches(
|
||||
TEST_PACKAGE_NAME);
|
||||
|
||||
when(mMediaController.getPackageName()).thenReturn(TEST_PACKAGE_NAME2);
|
||||
mMediaOutputIndicatorWorker.onSlicePinned();
|
||||
|
||||
assertThat(mMediaOutputIndicatorWorker.mLocalMediaManager.getPackageName()).matches(
|
||||
TEST_PACKAGE_NAME2);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSlicePinned_noActiveController_noPackageName() {
|
||||
mMediaControllers.clear();
|
||||
|
||||
mMediaOutputIndicatorWorker.onSlicePinned();
|
||||
|
||||
assertThat(mMediaOutputIndicatorWorker.mLocalMediaManager.getPackageName()).isNull();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void onSliceUnpinned_unRegisterCallback() {
|
||||
mMediaOutputIndicatorWorker.mLocalMediaManager = mLocalMediaManager;
|
||||
@@ -138,6 +167,16 @@ public class MediaOutputIndicatorWorkerTest {
|
||||
|
||||
@Test
|
||||
public void getActiveLocalMediaController_localMediaPlaying_returnController() {
|
||||
initPlayback();
|
||||
|
||||
when(mMediaController.getPlaybackInfo()).thenReturn(mPlaybackInfo);
|
||||
when(mMediaController.getPlaybackState()).thenReturn(mPlaybackState);
|
||||
|
||||
assertThat(mMediaOutputIndicatorWorker.getActiveLocalMediaController()).isEqualTo(
|
||||
mMediaController);
|
||||
}
|
||||
|
||||
private void initPlayback() {
|
||||
mPlaybackInfo = new MediaController.PlaybackInfo(
|
||||
MediaController.PlaybackInfo.PLAYBACK_TYPE_LOCAL,
|
||||
VolumeProvider.VOLUME_CONTROL_ABSOLUTE,
|
||||
@@ -148,12 +187,6 @@ public class MediaOutputIndicatorWorkerTest {
|
||||
mPlaybackState = new PlaybackState.Builder()
|
||||
.setState(PlaybackState.STATE_PLAYING, 0, 1)
|
||||
.build();
|
||||
|
||||
when(mMediaController.getPlaybackInfo()).thenReturn(mPlaybackInfo);
|
||||
when(mMediaController.getPlaybackState()).thenReturn(mPlaybackState);
|
||||
|
||||
assertThat(mMediaOutputIndicatorWorker.getActiveLocalMediaController()).isEqualTo(
|
||||
mMediaController);
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user