Snap for 7450397 from 9f7564c1b6 to sc-release

Change-Id: I6d6286999b14398018746b8fb06d30a1f9f0f421
This commit is contained in:
android-build-team Robot
2021-06-12 03:08:01 +00:00
15 changed files with 135 additions and 158 deletions

View File

@@ -713,7 +713,8 @@
<activity
android:name="Settings$ManageAssistActivity"
android:exported="true"
android:label="@string/assist_and_voice_input_title">
android:label="@string/assist_and_voice_input_title"
android:theme="@style/Theme.SubSettings">
<intent-filter android:priority="1">
<action android:name="android.settings.VOICE_INPUT_SETTINGS" />
<category android:name="android.intent.category.DEFAULT" />

View File

@@ -1,28 +0,0 @@
<!--
Copyright (C) 2021 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10c0.34,0 0.68,-0.02 1.01,-0.05V20h-1v-0.04c-0.83,-1.2 -1.48,-2.53 -1.91,-3.96H13v-2H9.66c-0.09,-0.66 -0.16,-1.32 -0.16,-2s0.07,-1.35 0.16,-2H21.8C20.87,5.44 16.83,2 11.99,2zM18.92,8h-2.95c-0.32,-1.25 -0.78,-2.45 -1.38,-3.56C16.43,5.07 17.96,6.35 18.92,8zM12,4.04c0.83,1.2 1.48,2.53 1.91,3.96h-3.82C10.52,6.57 11.17,5.24 12,4.04zM4.26,14C4.1,13.36 4,12.69 4,12s0.1,-1.36 0.26,-2h3.38c-0.08,0.66 -0.14,1.32 -0.14,2s0.06,1.34 0.14,2H4.26zM5.08,16h2.95c0.32,1.25 0.78,2.45 1.38,3.56C7.57,18.93 6.04,17.66 5.08,16zM8.03,8H5.08c0.96,-1.66 2.49,-2.93 4.33,-3.56C8.81,5.55 8.35,6.75 8.03,8z"
android:fillAlpha="0.3"/>
<path
android:fillColor="#FF000000"
android:pathData="M22,19.3v-0.9l-3.37,-2.25v-2.47C18.63,13.3 18.35,13 18,13s-0.63,0.3 -0.63,0.68v2.47L14,18.4v0.9l3.37,-1.12v2.48l-0.84,0.68V22L18,21.55L19.47,22v-0.67l-0.84,-0.68v-2.48L22,19.3z"/>
</vector>

View File

@@ -0,0 +1,28 @@
<!--
Copyright (C) 2021 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.
-->
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24.0"
android:viewportHeight="24.0">
<path
android:fillColor="#FF000000"
android:pathData="M2,12C2,6.48 6.47,2 11.99,2C17.52,2 22,6.48 22,12c0,0.34 -0.02,0.67 -0.05,1h-2.02c0.04,-0.33 0.07,-0.66 0.07,-1c0,-0.69 -0.1,-1.36 -0.26,-2h-3.38c0.08,0.66 0.14,1.32 0.14,2c0,0.34 -0.01,0.67 -0.04,1h-2.01c0.03,-0.33 0.05,-0.66 0.05,-1c0,-0.68 -0.07,-1.35 -0.16,-2H9.66c-0.09,0.65 -0.16,1.32 -0.16,2s0.07,1.34 0.16,2H13v2h-2.91c0.43,1.43 1.08,2.76 1.91,3.96V20h1v1.95C12.67,21.98 12.33,22 11.99,22C6.47,22 2,17.52 2,12zM15.97,8h2.95c-0.96,-1.65 -2.49,-2.93 -4.33,-3.56C15.19,5.55 15.65,6.75 15.97,8zM13.91,8C13.48,6.57 12.83,5.24 12,4.04c-0.83,1.2 -1.48,2.53 -1.91,3.96H13.91zM4,12c0,0.69 0.1,1.36 0.26,2h3.38c-0.08,-0.66 -0.14,-1.32 -0.14,-2s0.06,-1.34 0.14,-2H4.26C4.1,10.64 4,11.31 4,12zM8.03,16H5.08c0.96,1.66 2.49,2.93 4.33,3.56C8.81,18.45 8.35,17.25 8.03,16zM5.08,8h2.95c0.32,-1.25 0.78,-2.45 1.38,-3.56C7.57,5.07 6.04,6.34 5.08,8z"
android:fillAlpha="0.3"/>
<path
android:fillColor="#FF000000"
android:pathData="M22,16.41L20.59,15l-2.09,2.09L16.41,15L15,16.41l2.09,2.09L15,20.59L16.41,22l2.09,-2.08L20.59,22L22,20.59l-2.08,-2.09L22,16.41z"/>
</vector>

View File

@@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2021 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.
-->
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@android:color/transparent">
<com.android.settingslib.widget.settingsspinner.SettingsSpinner
android:id="@+id/filter_spinner"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_marginStart="24dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="8dp"
android:theme="@style/Widget.PopupWindow.Settings"/>
</FrameLayout>

View File

@@ -17,16 +17,19 @@
package com.android.settings.accounts;
import android.content.Context;
import android.content.Intent;
import android.provider.Settings;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
import com.android.settings.enterprise.EnterprisePrivacyFeatureProvider;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.widget.FooterPreference;
public class EnterpriseDisclosurePreferenceController extends BasePreferenceController {
private final EnterprisePrivacyFeatureProvider mFeatureProvider;
public EnterpriseDisclosurePreferenceController(Context context, String key) {
@@ -36,6 +39,16 @@ public class EnterpriseDisclosurePreferenceController extends BasePreferenceCont
.getEnterprisePrivacyFeatureProvider(mContext);
}
@Override
public void displayPreference(PreferenceScreen screen) {
super.displayPreference(screen);
final CharSequence disclosure = getDisclosure();
if (disclosure == null) {
return;
}
updateFooterPreference(screen, disclosure);
}
@Override
public int getAvailabilityStatus() {
if (getDisclosure() == null) {
@@ -49,12 +62,18 @@ public class EnterpriseDisclosurePreferenceController extends BasePreferenceCont
return mFeatureProvider.getDeviceOwnerDisclosure();
}
@Override
public void updateState(Preference preference) {
final CharSequence disclosure = getDisclosure();
if (disclosure == null) {
return;
}
preference.setTitle(disclosure);
void updateFooterPreference(PreferenceScreen screen, CharSequence disclosure) {
final FooterPreference footerPreference = screen.findPreference(getPreferenceKey());
footerPreference.setTitle(disclosure);
footerPreference.setLearnMoreAction(view -> {
mContext.startActivity(new Intent(Settings.ACTION_ENTERPRISE_PRIVACY_SETTINGS));
});
final String learnMoreContentDescription = mContext.getString(
R.string.footer_learn_more_content_description, getLabelName());
footerPreference.setLearnMoreContentDescription(learnMoreContentDescription);
}
private String getLabelName() {
return mContext.getString(R.string.header_add_an_account);
}
}

View File

@@ -434,7 +434,7 @@ public class ManageApplications extends InstrumentedFragment
final Activity activity = getActivity();
final FrameLayout pinnedHeader = mRootView.findViewById(R.id.pinned_header);
mSpinnerHeader = activity.getLayoutInflater()
.inflate(R.layout.apps_filter_spinner, pinnedHeader, false);
.inflate(R.layout.manage_apps_filter_spinner, pinnedHeader, false);
mFilterSpinner = mSpinnerHeader.findViewById(R.id.filter_spinner);
mFilterAdapter = new FilterSpinnerAdapter(this);
mFilterSpinner.setAdapter(mFilterAdapter);

View File

@@ -360,6 +360,11 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
// Icon provided by the content provider overrides any static icon.
if (tile.getMetaData() != null
&& tile.getMetaData().containsKey(META_DATA_PREFERENCE_ICON_URI)) {
// Set a transparent color before starting to fetch the real icon, this is necessary
// to avoid preference padding change.
setPreferenceIcon(preference, tile, forceRoundedIcon, mContext.getPackageName(),
Icon.createWithResource(mContext, android.R.color.transparent));
ThreadUtils.postOnBackgroundThread(() -> {
final Intent intent = tile.getIntent();
String packageName = null;

View File

@@ -100,9 +100,6 @@ public class EnterprisePrivacyFeatureProviderImpl implements EnterprisePrivacyFe
} else {
disclosure.append(mResources.getString(R.string.do_disclosure_generic));
}
disclosure.append(mResources.getString(R.string.do_disclosure_learn_more_separator));
disclosure.append(mResources.getString(R.string.learn_more),
new EnterprisePrivacySpan(mContext), 0);
return disclosure;
}

View File

@@ -65,7 +65,7 @@ public class InternetPreferenceController extends AbstractPreferenceController i
@VisibleForTesting
static Map<Integer, Integer> sIconMap = new HashMap<>();
static {
sIconMap.put(INTERNET_OFF, R.drawable.ic_no_internet_airplane);
sIconMap.put(INTERNET_OFF, R.drawable.ic_no_internet_unavailable);
sIconMap.put(INTERNET_NETWORKS_AVAILABLE, R.drawable.ic_no_internet_available);
sIconMap.put(INTERNET_WIFI, R.drawable.ic_wifi_signal_4);
sIconMap.put(INTERNET_CELLULAR, R.drawable.ic_network_cell);

View File

@@ -31,6 +31,7 @@ import androidx.preference.SwitchPreference;
import com.android.settings.R;
import com.android.settings.network.SubscriptionUtil;
import com.android.settings.network.ims.WifiCallingQueryImsState;
import java.util.List;
import java.util.Objects;
@@ -147,16 +148,20 @@ public class BackupCallingPreferenceController extends TelephonyTogglePreference
}
private boolean hasBackupCallingFeature(int subscriptionId) {
PersistableBundle carrierConfig = getCarrierConfigForSubId(subscriptionId);
Boolean featureEnableStatus = null;
if (carrierConfig != null) {
featureEnableStatus = carrierConfig.getBoolean(
CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL, false);
return isCrossSimEnabledByPlatform(mContext, subscriptionId);
}
protected boolean isCrossSimEnabledByPlatform(Context context, int subscriptionId) {
// TODO : Change into API which created for accessing
// com.android.ims.ImsManager#isCrossSimEnabledByPlatform()
if ((new WifiCallingQueryImsState(context, subscriptionId)).isWifiCallingSupported()) {
PersistableBundle bundle = getCarrierConfigForSubId(subscriptionId);
return (bundle != null) && bundle.getBoolean(
CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL,
false /*default*/);
}
// TODO: remove log after fixing b/182326102
Log.d(LOG_TAG, "config " + CarrierConfigManager.KEY_CARRIER_CROSS_SIM_IMS_AVAILABLE_BOOL
+ "=" + featureEnableStatus + " for subId=" + subscriptionId);
return (featureEnableStatus != null) && featureEnableStatus.booleanValue();
Log.d(LOG_TAG, "Not supported by framework. subId = " + subscriptionId);
return false;
}
private ImsMmTelManager getImsMmTelManager(int subId) {

View File

@@ -20,8 +20,6 @@ import android.content.Context;
import android.os.Bundle;
import android.provider.Settings;
import com.android.settings.Utils;
public class PanelFeatureProviderImpl implements PanelFeatureProvider {
@Override
@@ -41,9 +39,6 @@ public class PanelFeatureProviderImpl implements PanelFeatureProvider {
case Settings.Panel.ACTION_NFC:
return NfcPanel.create(context);
case Settings.Panel.ACTION_WIFI:
if (Utils.isProviderModelEnabled(context)) {
return InternetConnectivityPanel.create(context);
}
return WifiPanel.create(context);
case Settings.Panel.ACTION_VOLUME:
return VolumePanel.create(context);

View File

@@ -63,6 +63,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceCategory;
import androidx.preference.PreferenceFragmentCompat;
import androidx.preference.PreferenceScreen;
import androidx.recyclerview.widget.RecyclerView;
import com.android.net.module.util.Inet4AddressUtils;
import com.android.settings.R;
@@ -513,6 +514,12 @@ public class WifiDetailPreferenceController2 extends AbstractPreferenceControlle
@Override
public void onResume() {
// Disable the animation of the EntityHeaderController
final RecyclerView recyclerView = mFragment.getListView();
if (recyclerView != null) {
recyclerView.setItemAnimator(null);
}
// Ensure mNetwork is set before any callbacks above are delivered, since our
// NetworkCallback only looks at changes to mNetwork.
updateNetworkInfo();

View File

@@ -19,20 +19,25 @@ package com.android.settings.accounts;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.ArgumentMatchers.any;
import static org.mockito.ArgumentMatchers.anyString;
import static org.mockito.Mockito.doReturn;
import static org.mockito.Mockito.never;
import static org.mockito.Mockito.spy;
import static org.mockito.Mockito.verify;
import static org.mockito.Mockito.when;
import android.content.Context;
import androidx.preference.Preference;
import androidx.preference.PreferenceScreen;
import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.widget.FooterPreference;
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;
@@ -42,13 +47,18 @@ public class EnterpriseDisclosurePreferenceControllerTest {
private Context mContext;
private EnterpriseDisclosurePreferenceController mController;
private Preference mPreference;
private FooterPreference mPreference;
@Mock
private PreferenceScreen mPreferenceScreen;
@Before
public void setUp() {
MockitoAnnotations.initMocks(this);
mContext = RuntimeEnvironment.application;
mController = spy(new EnterpriseDisclosurePreferenceController(mContext, "my_key"));
mPreference = spy(new Preference(mContext));
mPreference = spy(new FooterPreference(mContext));
when(mPreferenceScreen.findPreference(anyString())).thenReturn(mPreference);
}
@Test
@@ -68,19 +78,19 @@ public class EnterpriseDisclosurePreferenceControllerTest {
}
@Test
public void updateState_hasDisclosure_shouldSetTitle() {
public void displayPreference_hasDisclosure_shouldSetTitle() {
doReturn(TEST_DISCLOSURE).when(mController).getDisclosure();
mController.updateState(mPreference);
mController.displayPreference(mPreferenceScreen);
assertThat(mPreference.getTitle()).isEqualTo(TEST_DISCLOSURE);
}
@Test
public void updateState_noDisclosure_shouldBeInvisible() {
public void displayPreference_noDisclosure_shouldBeInvisible() {
doReturn(null).when(mController).getDisclosure();
mController.updateState(mPreference);
mController.displayPreference(mPreferenceScreen);
verify(mPreference, never()).setTitle(any());
}

View File

@@ -27,10 +27,7 @@ import android.provider.Settings;
import androidx.test.core.app.ApplicationProvider;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import com.android.settings.testutils.FeatureFlagUtilsRule;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -39,9 +36,6 @@ public class PanelFeatureProviderImplTest {
private static final String TEST_PACKAGENAME = "com.test.packagename";
@Rule
public final FeatureFlagUtilsRule mFeatureFlagUtilsRule = new FeatureFlagUtilsRule();
private Context mContext;
private PanelFeatureProviderImpl mProvider;
private Bundle mBundle;
@@ -71,24 +65,4 @@ public class PanelFeatureProviderImplTest {
assertThat(panel).isInstanceOf(VolumePanel.class);
}
@Test
public void getPanel_wifi_returnsWifiPanelWhenProviderModelDisable() {
mFeatureFlagUtilsRule.setProviderModelEnabled(false);
mBundle.putString(KEY_PANEL_TYPE_ARGUMENT, Settings.Panel.ACTION_WIFI);
final PanelContent panel = mProvider.getPanel(mContext, mBundle);
assertThat(panel).isInstanceOf(WifiPanel.class);
}
@Test
public void getPanel_wifi_returnsInternetConnectivityPanelWhenProviderModelDisable() {
mFeatureFlagUtilsRule.setProviderModelEnabled(true);
mBundle.putString(KEY_PANEL_TYPE_ARGUMENT, Settings.Panel.ACTION_WIFI);
final PanelContent panel = mProvider.getPanel(mContext, mBundle);
assertThat(panel).isInstanceOf(InternetConnectivityPanel.class);
}
}

View File

@@ -1,68 +0,0 @@
/*
* Copyright (C) 2020 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.
*/
package com.android.settings.testutils;
import android.content.Context;
import android.util.FeatureFlagUtils;
import androidx.test.core.app.ApplicationProvider;
import org.junit.rules.ExternalResource;
import java.util.HashMap;
import java.util.Map;
/**
* A test rule that is used to automatically recover the FeatureFlagUtils resource after testing.
*
* Example:
* <pre class="code"><code class="java">
* public class ExampleTest {
*
* &#064;Rule
* public final FeatureFlagUtilsRule mFeatureFlagUtilsRule = new FeatureFlagUtilsRule();
*
* }
* </code></pre>
*/
public class FeatureFlagUtilsRule extends ExternalResource {
private Context mContext;
private Map<String, Boolean> mBackupFeatureFlags = new HashMap<String, Boolean>();
@Override
protected void before() throws Throwable {
mContext = ApplicationProvider.getApplicationContext();
}
@Override
protected void after() {
mBackupFeatureFlags.forEach((k, v) -> FeatureFlagUtils.setEnabled(mContext, k, v));
}
public void setEnabled(String feature, boolean enabled) {
if (enabled == FeatureFlagUtils.isEnabled(mContext, feature)) {
return;
}
mBackupFeatureFlags.putIfAbsent(feature, !enabled);
FeatureFlagUtils.setEnabled(mContext, feature, enabled);
}
public void setProviderModelEnabled(boolean enabled) {
setEnabled(FeatureFlagUtils.SETTINGS_PROVIDER_MODEL, enabled);
}
}