PIP: Use resource to maintain settings class list to shift PIP to left
Bug: 31322754 Test: manual test Change-Id: Ic36c2437409d8d1fcddd71087eda754f1a8752e1
This commit is contained in:
31
packages/SystemUI/res/values/arrays_tv.xml
Normal file
31
packages/SystemUI/res/values/arrays_tv.xml
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<!--
|
||||||
|
/**
|
||||||
|
* Copyright (c) 2017, The Android Open Source Project
|
||||||
|
*
|
||||||
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
* you may not use this file except in compliance with the License.
|
||||||
|
* You may obtain a copy of the License at
|
||||||
|
*
|
||||||
|
* http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
*
|
||||||
|
* Unless required by applicable law or agreed to in writing, software
|
||||||
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
* See the License for the specific language governing permissions and
|
||||||
|
* limitations under the License.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
<resources>
|
||||||
|
<!-- List of package name or class name which are considered as Settings,
|
||||||
|
so PIP location should be adjusted to the left of the side panel.
|
||||||
|
This can be overriden in an overlay -->
|
||||||
|
<string-array name="tv_pip_settings_class_name" translatable="false">
|
||||||
|
<item>com.android.tv.settings</item>
|
||||||
|
<item>com.google.android.leanbacklauncher/.settings.HomeScreenSettingsActivity</item>
|
||||||
|
<item>com.google.android.apps.mediashell/.settings.CastSettingsActivity</item>
|
||||||
|
<item>com.google.android.katniss.setting/.SpeechSettingsActivity</item>
|
||||||
|
<item>com.google.android.katniss.setting/.SearchSettingsActivity</item>
|
||||||
|
<item>com.google.android.gsf.notouch/.UsageDiagnosticsSettingActivity</item>
|
||||||
|
</string-array>
|
||||||
|
</resources>
|
||||||
@@ -68,34 +68,10 @@ public class PipManager implements BasePipManager {
|
|||||||
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
private static final boolean DEBUG = Log.isLoggable(TAG, Log.DEBUG);
|
||||||
private static final boolean DEBUG_FORCE_ONBOARDING =
|
private static final boolean DEBUG_FORCE_ONBOARDING =
|
||||||
SystemProperties.getBoolean("debug.tv.pip_force_onboarding", false);
|
SystemProperties.getBoolean("debug.tv.pip_force_onboarding", false);
|
||||||
|
private static final String SETTINGS_PACKAGE_AND_CLASS_DELIMITER = "/";
|
||||||
|
|
||||||
private static PipManager sPipManager;
|
private static PipManager sPipManager;
|
||||||
|
private static List<Pair<String, String>> sSettingsPackageAndClassNamePairList;
|
||||||
/**
|
|
||||||
* List of package and class name which are considered as Settings,
|
|
||||||
* so PIP location should be adjusted to the left of the side panel.
|
|
||||||
*/
|
|
||||||
private static final List<Pair<String, String>> sSettingsPackageAndClassNamePairList;
|
|
||||||
static {
|
|
||||||
sSettingsPackageAndClassNamePairList = new ArrayList<>();
|
|
||||||
sSettingsPackageAndClassNamePairList.add(new Pair<String, String>(
|
|
||||||
"com.android.tv.settings", null));
|
|
||||||
sSettingsPackageAndClassNamePairList.add(new Pair<String, String>(
|
|
||||||
"com.google.android.leanbacklauncher",
|
|
||||||
"com.google.android.leanbacklauncher.settings.HomeScreenSettingsActivity"));
|
|
||||||
sSettingsPackageAndClassNamePairList.add(new Pair<String, String>(
|
|
||||||
"com.google.android.apps.mediashell",
|
|
||||||
"com.google.android.apps.mediashell.settings.CastSettingsActivity"));
|
|
||||||
sSettingsPackageAndClassNamePairList.add(new Pair<String, String>(
|
|
||||||
"com.google.android.katniss",
|
|
||||||
"com.google.android.katniss.setting.SpeechSettingsActivity"));
|
|
||||||
sSettingsPackageAndClassNamePairList.add(new Pair<String, String>(
|
|
||||||
"com.google.android.katniss",
|
|
||||||
"com.google.android.katniss.setting.SearchSettingsActivity"));
|
|
||||||
sSettingsPackageAndClassNamePairList.add(new Pair<String, String>(
|
|
||||||
"com.google.android.gsf.notouch",
|
|
||||||
"com.google.android.gsf.notouch.UsageDiagnosticsSettingActivity"));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* State when there's no PIP.
|
* State when there's no PIP.
|
||||||
@@ -252,6 +228,31 @@ public class PipManager implements BasePipManager {
|
|||||||
mOnboardingShown = Prefs.getBoolean(
|
mOnboardingShown = Prefs.getBoolean(
|
||||||
mContext, TV_PICTURE_IN_PICTURE_ONBOARDING_SHOWN, false);
|
mContext, TV_PICTURE_IN_PICTURE_ONBOARDING_SHOWN, false);
|
||||||
|
|
||||||
|
if (sSettingsPackageAndClassNamePairList == null) {
|
||||||
|
String[] settings = mContext.getResources().getStringArray(
|
||||||
|
R.array.tv_pip_settings_class_name);
|
||||||
|
sSettingsPackageAndClassNamePairList = new ArrayList<>();
|
||||||
|
if (settings != null) {
|
||||||
|
for (int i = 0; i < settings.length; i++) {
|
||||||
|
Pair<String, String> entry = null;
|
||||||
|
String[] packageAndClassName =
|
||||||
|
settings[i].split(SETTINGS_PACKAGE_AND_CLASS_DELIMITER);
|
||||||
|
switch (packageAndClassName.length) {
|
||||||
|
case 1:
|
||||||
|
entry = Pair.<String, String>create(packageAndClassName[0], null);
|
||||||
|
break;
|
||||||
|
case 2:
|
||||||
|
entry = Pair.<String, String>create(
|
||||||
|
packageAndClassName[0],
|
||||||
|
packageAndClassName[0] + packageAndClassName[1]);
|
||||||
|
}
|
||||||
|
if (entry != null) {
|
||||||
|
sSettingsPackageAndClassNamePairList.add(entry);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loadConfigurationsAndApply();
|
loadConfigurationsAndApply();
|
||||||
mPipRecentsOverlayManager = new PipRecentsOverlayManager(context);
|
mPipRecentsOverlayManager = new PipRecentsOverlayManager(context);
|
||||||
mMediaSessionManager =
|
mMediaSessionManager =
|
||||||
|
|||||||
Reference in New Issue
Block a user