Snap for 9815702 from 5face72c87 to udc-release

Change-Id: Ief5e8f9c0e8bb464b011ff8fc87be1fc9a9ff788
This commit is contained in:
Android Build Coastguard Worker
2023-03-25 03:27:25 +00:00
7 changed files with 89 additions and 113 deletions

View File

@@ -15,21 +15,24 @@
-->
<com.android.settings.localepicker.LocaleDragCell
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:listPreferredItemHeight"
android:background="?android:colorBackground"
android:layout_marginTop="4dp"
android:layout_marginBottom="4dp"
android:layoutDirection="locale"
android:textDirection="locale">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="?android:listPreferredItemHeight"
android:background="?android:colorBackground"
android:layout_marginTop="12dp"
android:layout_marginBottom="12dp"
android:layoutDirection="locale"
android:textDirection="locale">
<CheckBox
android:id="@+id/checkbox"
style="@style/LanguageCheckboxAndLabel"
android:paddingStart="24dp"
android:layout_toStartOf="@+id/dragHandle"/>
android:layout_toStartOf="@+id/dragHandle"
android:layout_alignTop="@+id/miniLabel"
android:layout_alignBottom="@+id/miniLabel" />
<TextView
android:id="@+id/miniLabel"
@@ -38,37 +41,44 @@
android:textColor="?android:attr/colorAccent"
android:minWidth="24sp"
android:gravity="center_vertical|center_horizontal"
android:layout_alignTop="@id/checkbox"
android:layout_alignBottom="@id/checkbox"/>
android:layout_centerVertical="true"/>
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:minHeight="?android:listPreferredItemHeight"
android:paddingStart="56dp"
android:layout_toStartOf="@+id/dragHandle">
<TextView
android:id="@+id/label"
style="@style/LanguageCheckboxAndLabel"/>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent">
<TextView
android:id="@+id/label"
style="@style/LanguageCheckboxAndLabel" />
<TextView
android:id="@+id/l10nWarn"
style="@style/LanguageCheckboxAndLabel"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:textColorSecondary"
android:layout_marginBottom="4dp"
android:text="@string/locale_not_translated"/>
<TextView
android:id="@+id/l10nWarn"
style="@style/LanguageCheckboxAndLabel"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:textColorSecondary"
android:layout_marginTop="4dp"
android:text="@string/locale_not_translated"/>
<TextView
android:id="@+id/default_locale"
style="@style/LanguageCheckboxAndLabel"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:textColorSecondary"
android:layout_marginBottom="4dp"
android:text="@string/desc_current_default_language"/>
<TextView
android:id="@+id/default_locale"
style="@style/LanguageCheckboxAndLabel"
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
android:textColor="?android:textColorSecondary"
android:layout_marginTop="4dp"
android:text="@string/desc_current_default_language"/>
</LinearLayout>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<ImageView
android:id="@+id/dragHandle"
@@ -80,13 +90,6 @@
android:src="@drawable/drag_handle"
android:importantForAccessibility="no"
android:layout_alignParentEnd="true"
android:layout_alignTop="@id/checkbox"
android:layout_alignBottom="@id/checkbox"/>
android:layout_centerVertical="true"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?android:attr/listDivider"
android:layout_alignParentBottom="true"/>
</com.android.settings.localepicker.LocaleDragCell>
</com.android.settings.localepicker.LocaleDragCell>

View File

@@ -370,7 +370,7 @@
<string name="desc_notice_of_language_picker">To select a language for each app, go to app language settings.</string>
<!-- Title for locale helper page [CHAR LIMIT=NONE] -->
<string name="desc_locale_helper_footer_general">Learn more about languages</string>
<string name="desc_locale_helper_footer_general">Learn more about app languages</string>
<!-- Link for Locale helper page. [CHAR LIMIT=NONE]-->
<string name="link_locale_picker_footer_learn_more" translatable="false">https://support.google.com/android?p=per_language_app_settings</string>
@@ -7611,8 +7611,8 @@
<!-- Configure lock screen: Title for the option of unlocking directly to home. [CHAR LIMIT=30] -->
<string name="lockscreen_bypass_title">Skip lock screen</string>
<!-- Configure lock screen: Summary for the option of unlocking directly to home. [CHAR LIMIT=100] -->
<string name="lockscreen_bypass_summary">After unlocking, go directly to last used screen</string>
<!-- Configure lock screen: Summary for the option of unlocking directly to home. [CHAR LIMIT=150] -->
<string name="lockscreen_bypass_summary">After unlocking, go directly to last used screen. Notifications wont show on lock screen. Swipe down from top to see them.</string>
<!-- Configure lock screen: Search keywords for the option of unlocking directly to home. [CHAR LIMIT=100] -->
<string name="keywords_lockscreen_bypass">Lock screen, Lockscreen, Skip, Bypass</string>

View File

@@ -53,7 +53,8 @@ public class AppStoreUtil {
// so we choose to ignore this when supplied by a non-system app.
String originatingPackageName = source.getOriginatingPackageName();
String initiatingPackageName = source.getInitiatingPackageName();
if (originatingPackageName != null && initiatingPackageName != null) {
if (originatingPackageName != null && initiatingPackageName != null
&& !initiatingPackageName.equals("com.android.shell")) {
ApplicationInfo ai = context.getPackageManager().getApplicationInfo(
initiatingPackageName, 0);
if ((ai.flags & ApplicationInfo.FLAG_SYSTEM) != 0) {

View File

@@ -20,6 +20,7 @@ import android.bluetooth.BluetoothCsipSetCoordinator;
import android.bluetooth.BluetoothDevice;
import android.bluetooth.BluetoothProfile;
import android.content.Context;
import android.os.SystemProperties;
import android.provider.DeviceConfig;
import android.text.TextUtils;
import android.util.Log;
@@ -66,6 +67,9 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
@VisibleForTesting
static final String HIGH_QUALITY_AUDIO_PREF_TAG = "A2dpProfileHighQualityAudio";
private static final String ENABLE_DUAL_MODE_AUDIO =
"persist.bluetooth.enable_dual_mode_audio";
private LocalBluetoothManager mManager;
private LocalBluetoothProfileManager mProfileManager;
private CachedBluetoothDevice mCachedDevice;
@@ -118,40 +122,17 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
/**
* Refreshes the state for an existing SwitchPreference for a profile.
* If the LeAudio profile is enabled on the LeAudio devices, then the SwitchPreferences of
* A2dp profile and Headset profile are graied out.
*/
private void refreshProfilePreference(SwitchPreference profilePref,
LocalBluetoothProfile profile) {
BluetoothDevice device = mCachedDevice.getDevice();
boolean isLeAudioEnabled = isLeAudioEnabled();
if (profile instanceof A2dpProfile
|| profile instanceof HeadsetProfile) {
if (isLeAudioEnabled) {
// If the LeAudio profile is enabled on the LeAudio devices, then the
// SwitchPreferences of A2dp profile and Headset profile are grayed out.
Log.d(TAG, "LE is enabled, gray out " + profile.toString());
profilePref.setEnabled(false);
} else {
List<CachedBluetoothDevice> deviceList = mProfileDeviceMap.get(
profile.toString());
boolean isBusy = deviceList != null
&& deviceList.stream().anyMatch(item -> item.isBusy());
profilePref.setEnabled(!isBusy);
}
} else if (profile instanceof LeAudioProfile) {
List<CachedBluetoothDevice> leAudioDeviceList = mProfileDeviceMap.get(
if (profile instanceof A2dpProfile || profile instanceof HeadsetProfile
|| profile instanceof LeAudioProfile) {
List<CachedBluetoothDevice> deviceList = mProfileDeviceMap.get(
profile.toString());
boolean isBusy = leAudioDeviceList != null
&& leAudioDeviceList.stream().anyMatch(item -> item.isBusy());
if (isLeAudioEnabled && !isBusy) {
LocalBluetoothProfile a2dp = mProfileManager.getA2dpProfile();
LocalBluetoothProfile headset = mProfileManager.getHeadsetProfile();
// If the LeAudio profile is enabled on the LeAudio devices, then the
// SwitchPreferences of A2dp profile and Headset profile are graied out.
grayOutPreferenceWhenLeAudioIsEnabled(a2dp);
grayOutPreferenceWhenLeAudioIsEnabled(headset);
}
boolean isBusy = deviceList != null
&& deviceList.stream().anyMatch(item -> item.isBusy());
profilePref.setEnabled(!isBusy);
} else if (profile instanceof PbapServerProfile
&& isLeAudioEnabled
@@ -183,7 +164,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
highQualityPref.setVisible(true);
highQualityPref.setTitle(a2dp.getHighQualityAudioOptionLabel(device));
highQualityPref.setChecked(a2dp.isHighQualityAudioEnabled(device));
highQualityPref.setEnabled(!mCachedDevice.isBusy() && !isLeAudioEnabled);
highQualityPref.setEnabled(!mCachedDevice.isBusy());
} else {
highQualityPref.setVisible(false);
}
@@ -205,16 +186,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
return false;
}
private void grayOutPreferenceWhenLeAudioIsEnabled(LocalBluetoothProfile profile) {
if (profile != null) {
SwitchPreference pref = mProfilesContainer.findPreference(profile.toString());
if (pref != null) {
Log.d(TAG, "LE is enabled, gray out " + profile.toString());
pref.setEnabled(false);
}
}
}
/**
* Helper method to enable a profile for a device.
*/
@@ -321,6 +292,17 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
if (mapPermission != BluetoothDevice.ACCESS_UNKNOWN) {
result.add(mapProfile);
}
// Removes phone calls & media audio toggles for dual mode devices
boolean leAudioSupported = result.contains(
mManager.getProfileManager().getLeAudioProfile());
boolean classicAudioSupported = result.contains(
mManager.getProfileManager().getA2dpProfile()) || result.contains(
mManager.getProfileManager().getHeadsetProfile());
if (leAudioSupported && classicAudioSupported) {
result.remove(mManager.getProfileManager().getA2dpProfile());
result.remove(mManager.getProfileManager().getHeadsetProfile());
}
Log.d(TAG, "getProfiles:result:" + result);
return result;
}
@@ -340,10 +322,7 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
}
/**
* When user disable the Le Audio profile, the system needs to do two things.
* 1) Disable the Le Audio profile, VCP and CSIP for each of the Le Audio devices.
* 2) Enable the A2dp profile and Headset profile for the associated device. The system
* can't enable the A2dp profile and Headset profile if the Le Audio profile is enabled.
* Disable the Le Audio profile, VCP, and CSIP for each of the Le Audio devices.
*
* @param profile the LeAudio profile
*/
@@ -354,8 +333,6 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
}
LocalBluetoothProfile vcp = mProfileManager.getVolumeControlProfile();
LocalBluetoothProfile csip = mProfileManager.getCsipSetCoordinatorProfile();
LocalBluetoothProfile a2dp = mProfileManager.getA2dpProfile();
LocalBluetoothProfile headset = mProfileManager.getHeadsetProfile();
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
Log.d(TAG,
@@ -369,15 +346,15 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
}
}
enableProfileAfterUserDisablesLeAudio(a2dp);
enableProfileAfterUserDisablesLeAudio(headset);
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
Log.i(TAG, "Enabling classic audio profiles because dual mode is disabled");
enableProfileAfterUserDisablesLeAudio(mProfileManager.getA2dpProfile());
enableProfileAfterUserDisablesLeAudio(mProfileManager.getHeadsetProfile());
}
}
/**
* When user enable the Le Audio profile, the system needs to do two things.
* 1) Disable the A2dp profile and Headset profile for the associated device. The system
* can't enable the Le Audio if the A2dp profile and Headset profile are enabled.
* 2) Enable the Le Audio profile, VCP and CSIP for each of the Le Audio devices.
* Enable the Le Audio profile, VCP, and CSIP for each of the Le Audio devices.
*
* @param profile the LeAudio profile
*/
@@ -386,14 +363,15 @@ public class BluetoothDetailsProfilesController extends BluetoothDetailsControll
Log.e(TAG, "There is no the LE profile or no device in mProfileDeviceMap. Do nothing.");
return;
}
LocalBluetoothProfile a2dp = mProfileManager.getA2dpProfile();
LocalBluetoothProfile headset = mProfileManager.getHeadsetProfile();
if (!SystemProperties.getBoolean(ENABLE_DUAL_MODE_AUDIO, false)) {
Log.i(TAG, "Disabling classic audio profiles because dual mode is disabled");
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getA2dpProfile());
disableProfileBeforeUserEnablesLeAudio(mProfileManager.getHeadsetProfile());
}
LocalBluetoothProfile vcp = mProfileManager.getVolumeControlProfile();
LocalBluetoothProfile csip = mProfileManager.getCsipSetCoordinatorProfile();
disableProfileBeforeUserEnablesLeAudio(a2dp);
disableProfileBeforeUserEnablesLeAudio(headset);
for (CachedBluetoothDevice leAudioDevice : mProfileDeviceMap.get(profile.toString())) {
Log.d(TAG,
"User enable LE device: " + leAudioDevice.getDevice().getAnonymizedAddress());

View File

@@ -165,7 +165,7 @@ class LocaleDragAndDropAdapter
dragCell.setLabelAndDescription(label, description);
dragCell.setLocalized(feedItem.isTranslated());
dragCell.setCurrentDefault(feedItem.getLocale().equals(Locale.getDefault()));
dragCell.setCurrentDefault(feedItem.getLocale().equals(LocalePicker.getLocales().get(0)));
dragCell.setMiniLabel(mNumberFormatter.format(i + 1));
dragCell.setShowCheckbox(mRemoveMode);
dragCell.setShowMiniLabel(!mRemoveMode);

View File

@@ -21,13 +21,13 @@ import android.content.Context;
import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
import com.android.settings.search.BaseSearchIndexProvider;
import com.android.settingslib.search.SearchIndexable;
/**
* A page that configures the Location Services settings for work profile.
*
* Note that this page should not provide indexes because it is only used in the two tabs
* {@link ProfileSelectFragment} scenario and should not be launched independently.
*/
@SearchIndexable(forTarget = SearchIndexable.ALL & ~SearchIndexable.ARC)
public class LocationServicesForWork extends DashboardFragment {
private static final String TAG = "LocationServicesForWork";
@@ -51,10 +51,4 @@ public class LocationServicesForWork extends DashboardFragment {
super.onAttach(context);
use(LocationInjectedServicesForWorkPreferenceController.class).init(this);
}
/**
* For Search.
*/
public static final BaseSearchIndexProvider SEARCH_INDEX_DATA_PROVIDER =
new BaseSearchIndexProvider(R.xml.location_services_workprofile);
}

View File

@@ -489,7 +489,7 @@ public class MobileNetworkSettings extends AbstractMobileNetworkSettings impleme
Iterator<Integer> iterator = mSubscriptionInfoMap.keySet().iterator();
while (iterator.hasNext()) {
if (iterator.next() == mSubId) {
if (iterator.next() == mSubId && getActivity() != null) {
finishFragment();
return;
}