Merge "Update FingerprintEnrollFindSensor for landscape" into sc-dev
diff --git a/res/layout/locale_order_list.xml b/res/layout/locale_order_list.xml
index 929582f..a1f93cd 100644
--- a/res/layout/locale_order_list.xml
+++ b/res/layout/locale_order_list.xml
@@ -14,7 +14,7 @@
limitations under the License.
-->
-<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
+<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layoutDirection="locale"
@@ -48,4 +48,4 @@
</LinearLayout>
-</ScrollView>
+</androidx.core.widget.NestedScrollView>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index aeeffeb..2332909 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -9708,13 +9708,15 @@
<!-- Cancel button for Checking other supported links dialog. [CHAR LIMIT=20] -->
<string name="app_launch_dialog_cancel">Cancel</string>
- <!-- Title and button for links found dialog. -->
+ <!-- Title and button for supported links dialog. -->
<plurals name="app_launch_supported_links_title">
<item quantity="one"><xliff:g id="count">%d</xliff:g> supported link</item>
<item quantity="other"><xliff:g id="count">%d</xliff:g> supported links</item>
</plurals>
- <!-- Add button for links found dialog. [CHAR LIMIT=20] -->
+ <!-- Add button for supported links dialog. [CHAR LIMIT=20] -->
<string name="app_launch_supported_links_add">Add</string>
+ <!-- The subtext of the link title in supported links dialog. [CHAR LIMIT=30] -->
+ <string name="app_launch_supported_links_subtext">Opens in <xliff:g id="app_label" example="Reddit">%s</xliff:g></string>
<!-- Summary for app storage preference -->
<string name="storage_summary_format"><xliff:g id="size" example="30.00MB">%1$s</xliff:g> used in <xliff:g id="storage_type" example="internal memory">%2$s</xliff:g></string>
@@ -12673,10 +12675,8 @@
<string name="provider_internet_settings">Internet</string>
<!-- Provider Model: SIMs controls settings screen, item title to go into the SIMs settings -->
<string name="provider_network_settings_title">SIMs</string>
- <!-- Provider Model: Airplane mode networks controls settings screen -->
- <string name="airplane_safe_networks">Show airplane mode networks</string>
- <!-- Provider Model: Summary for showing airplane mode networks-->
- <string name="airplane_safe_networks_summary">Find and connect to networks in airplane mode.</string>
+ <!-- Provider Model: Summary for Wi-Fi switch [CHAR LIMIT=NONE] -->
+ <string name="wifi_switch_summary">Find and connect to Wi\u2011Fi networks</string>
<!-- Provider Model: List of synonyms for the airplane-safe networks, used to match in settings search [CHAR LIMIT=NONE] -->
<string name="keywords_airplane_safe_networks">airplane, airplane-safe</string>
<!-- Provider Model: Calls and SMS controllers settings screen, item title to go into the Calls and SMS settings -->
@@ -12851,4 +12851,7 @@
<string name="enable_2g_title">Allow 2G</string>
<!-- Title for toggle if user wants to enable 2G [CHAR LIMIT=NONE] -->
<string name="enable_2g_summary">Use 2G cellular connections. For emergency calls, 2G is always turned on.</string>
+
+ <!-- Label for extra app info settings for a specific app [CHAR LIMIT=40] -->
+ <string name="extra_app_info_label" translatable="false"></string>
</resources>
diff --git a/res/xml/app_info_settings_v2.xml b/res/xml/app_info_settings_v2.xml
index 805df59..574fc01 100644
--- a/res/xml/app_info_settings_v2.xml
+++ b/res/xml/app_info_settings_v2.xml
@@ -81,6 +81,11 @@
settings:controller="com.android.settings.applications.appinfo.AppDataUsagePreferenceController" />
<Preference
+ android:key="extra_app_info_settings"
+ android:title="@string/extra_app_info_label"
+ settings:controller="com.android.settings.applications.appinfo.ExtraAppInfoPreferenceController" />
+
+ <Preference
android:key="time_spent_in_app"
android:title="@string/time_spent_in_app_pref_title"
settings:controller="com.android.settings.applications.appinfo.TimeSpentInAppPreferenceController" />
diff --git a/res/xml/network_provider_internet.xml b/res/xml/network_provider_internet.xml
index 90a04f1..035026b 100644
--- a/res/xml/network_provider_internet.xml
+++ b/res/xml/network_provider_internet.xml
@@ -61,15 +61,6 @@
settings:controller="com.android.settings.network.AirplaneModePreferenceController"
settings:userRestriction="no_airplane_mode"/>
- <com.android.settingslib.RestrictedSwitchPreference
- android:key="airplane_safe_networks"
- android:title="@string/airplane_safe_networks"
- android:icon="@drawable/ic_airplane_safe_networks_24dp"
- android:summary="@string/airplane_safe_networks_summary"
- android:order="-4"
- settings:userRestriction="no_airplane_mode"
- settings:keywords="@string/keywords_airplane_safe_networks" />
-
<com.android.settingslib.RestrictedPreference
android:key="manage_mobile_plan"
android:title="@string/manage_mobile_plan_title"
diff --git a/res/xml/network_provider_settings.xml b/res/xml/network_provider_settings.xml
index 0a8dbaa..a824b34 100644
--- a/res/xml/network_provider_settings.xml
+++ b/res/xml/network_provider_settings.xml
@@ -56,6 +56,13 @@
android:key="access_points"
android:layout="@layout/preference_category_no_label"/>
+ <com.android.settingslib.RestrictedSwitchPreference
+ android:key="wifi_switch"
+ android:title="@string/wifi"
+ android:summary="@string/wifi_switch_summary"
+ settings:allowDividerAbove="true"
+ settings:keywords="@string/keywords_wifi"/>
+
<Preference
android:key="configure_wifi_settings"
android:title="@string/network_and_internet_preferences_title"
diff --git a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
index 6a86c71c..1878f5f 100755
--- a/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
+++ b/src/com/android/settings/applications/appinfo/AppInfoDashboardFragment.java
@@ -166,6 +166,9 @@
use(AppStoragePreferenceController.class).setParentFragment(this);
use(AppVersionPreferenceController.class).setParentFragment(this);
use(InstantAppDomainsPreferenceController.class).setParentFragment(this);
+ if (FeatureFlagUtils.isEnabled(context, FeatureFlags.SILKY_HOME)) {
+ use(ExtraAppInfoPreferenceController.class).setPackageName(packageName);
+ }
final WriteSystemSettingsPreferenceController writeSystemSettings =
use(WriteSystemSettingsPreferenceController.class);
diff --git a/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java
new file mode 100644
index 0000000..20938d1
--- /dev/null
+++ b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProvider.java
@@ -0,0 +1,37 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.applications.appinfo;
+
+import android.content.Context;
+
+/**
+ * Provider for Extra App Info related feature
+ */
+public interface ExtraAppInfoFeatureProvider {
+ /** Returns true if the feature is supported. */
+ boolean isSupported(Context context);
+
+ /**
+ * Launch ExtraAppInfoSettings
+ */
+ void launchExtraAppInfoSettings(Context context);
+
+ /**
+ * Sets the package name
+ */
+ void setPackageName(String packageName);
+}
diff --git a/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java
new file mode 100644
index 0000000..3e5ef78
--- /dev/null
+++ b/src/com/android/settings/applications/appinfo/ExtraAppInfoFeatureProviderImpl.java
@@ -0,0 +1,40 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.applications.appinfo;
+
+import android.content.Context;
+
+/**
+ * Provider for Extra App Info related feature
+ */
+public class ExtraAppInfoFeatureProviderImpl implements
+ ExtraAppInfoFeatureProvider {
+ @Override
+ public boolean isSupported(Context context) {
+ return false;
+ }
+
+ @Override
+ public void launchExtraAppInfoSettings(Context context) {
+ return;
+ }
+
+ @Override
+ public void setPackageName(String packageName) {
+ return;
+ }
+}
diff --git a/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java b/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java
new file mode 100644
index 0000000..0c1b3e3
--- /dev/null
+++ b/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceController.java
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.applications.appinfo;
+
+import android.content.Context;
+import android.text.TextUtils;
+
+import androidx.preference.Preference;
+
+import com.android.settings.core.BasePreferenceController;
+import com.android.settings.overlay.FeatureFactory;
+
+/** Contains logic that deals with showing extra app info in app settings. */
+public class ExtraAppInfoPreferenceController extends BasePreferenceController {
+
+ private final ExtraAppInfoFeatureProvider mExtraAppInfoFeatureProvider;
+
+ public ExtraAppInfoPreferenceController(Context context, String key) {
+ super(context, key);
+ mExtraAppInfoFeatureProvider =
+ FeatureFactory.getFactory(context).getExtraAppInfoFeatureProvider();
+ }
+
+ @Override
+ public int getAvailabilityStatus() {
+ return mExtraAppInfoFeatureProvider.isSupported(mContext)
+ ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
+ }
+
+ @Override
+ public boolean handlePreferenceTreeClick(Preference preference) {
+ if (TextUtils.equals(getPreferenceKey(), preference.getKey())) {
+ mExtraAppInfoFeatureProvider.launchExtraAppInfoSettings(mContext);
+ return true;
+ }
+ return super.handlePreferenceTreeClick(preference);
+ }
+
+ /**
+ * Set the local package name
+ */
+ public void setPackageName(String packageName) {
+ if (mExtraAppInfoFeatureProvider != null) {
+ mExtraAppInfoFeatureProvider.setPackageName(packageName);
+ }
+ }
+}
diff --git a/src/com/android/settings/applications/assist/OWNERS b/src/com/android/settings/applications/assist/OWNERS
new file mode 100644
index 0000000..22e486d
--- /dev/null
+++ b/src/com/android/settings/applications/assist/OWNERS
@@ -0,0 +1,9 @@
+# Default reviewers for this and subdirectories.
+adamhe@google.com
+augale@google.com
+joannechung@google.com
+lpeter@google.com
+svetoslavganov@google.com
+tymtsai@google.com
+
+# Emergency approvers in case the above are not available
diff --git a/src/com/android/settings/applications/autofill/OWNERS b/src/com/android/settings/applications/autofill/OWNERS
new file mode 100644
index 0000000..22e486d
--- /dev/null
+++ b/src/com/android/settings/applications/autofill/OWNERS
@@ -0,0 +1,9 @@
+# Default reviewers for this and subdirectories.
+adamhe@google.com
+augale@google.com
+joannechung@google.com
+lpeter@google.com
+svetoslavganov@google.com
+tymtsai@google.com
+
+# Emergency approvers in case the above are not available
diff --git a/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java b/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java
index c8a4c05..d767d53 100644
--- a/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java
+++ b/src/com/android/settings/biometrics/fingerprint/SetupFingerprintEnrollIntroduction.java
@@ -18,22 +18,18 @@
import android.app.Activity;
import android.app.KeyguardManager;
-import android.app.admin.DevicePolicyManager;
import android.app.settings.SettingsEnums;
import android.content.Intent;
import android.hardware.fingerprint.FingerprintManager;
import android.os.Bundle;
import android.os.UserHandle;
-import android.os.storage.StorageManager;
import android.view.View;
-import android.widget.TextView;
import com.android.internal.widget.LockPatternUtils;
import com.android.settings.R;
import com.android.settings.SetupWizardUtils;
import com.android.settings.Utils;
import com.android.settings.biometrics.BiometricUtils;
-import com.android.settings.password.ChooseLockGeneric.ChooseLockGenericFragment;
import com.android.settings.password.ChooseLockSettingsHelper;
import com.android.settings.password.SetupChooseLockGeneric;
import com.android.settings.password.SetupSkipDialog;
@@ -86,8 +82,7 @@
protected void initViews() {
super.initViews();
- TextView description = (TextView) findViewById(R.id.sud_layout_description);
- description.setText(
+ setDescriptionText(
R.string.security_settings_fingerprint_enroll_introduction_message_setup);
FooterButton nextButton = getNextButton();
diff --git a/src/com/android/settings/network/NetworkDashboardFragment.java b/src/com/android/settings/network/NetworkDashboardFragment.java
index 14d85e9..f023ced 100644
--- a/src/com/android/settings/network/NetworkDashboardFragment.java
+++ b/src/com/android/settings/network/NetworkDashboardFragment.java
@@ -146,7 +146,6 @@
controllers.add(privateDnsPreferenceController);
if (Utils.isProviderModelEnabled(context)) {
controllers.add(new NetworkProviderCallsSmsController(context, lifecycle));
- controllers.add(new AirplaneSafeNetworksPreferenceController(context, lifecycle));
}
return controllers;
}
diff --git a/src/com/android/settings/network/NetworkProviderSettings.java b/src/com/android/settings/network/NetworkProviderSettings.java
index ebf59a2..4d6849b 100644
--- a/src/com/android/settings/network/NetworkProviderSettings.java
+++ b/src/com/android/settings/network/NetworkProviderSettings.java
@@ -196,6 +196,7 @@
private PreferenceCategory mWifiEntryPreferenceCategory;
@VisibleForTesting
AddWifiNetworkPreference mAddWifiNetworkPreference;
+ private WifiSwitchPreferenceController mWifiSwitchPreferenceController;
@VisibleForTesting
Preference mConfigureWifiSettingsPreference;
@VisibleForTesting
@@ -270,6 +271,7 @@
addNetworkMobileProviderController();
addViewAirplaneModeNetworksButtonController();
addConnectedEthernetNetworkController();
+ addWifiSwitchPreferenceController();
}
private void addNetworkMobileProviderController() {
@@ -298,6 +300,14 @@
mConnectedEthernetNetworkController.displayPreference(getPreferenceScreen());
}
+ private void addWifiSwitchPreferenceController() {
+ if (mWifiSwitchPreferenceController == null) {
+ mWifiSwitchPreferenceController =
+ new WifiSwitchPreferenceController(getContext(), getSettingsLifecycle());
+ }
+ mWifiSwitchPreferenceController.displayPreference(getPreferenceScreen());
+ }
+
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
diff --git a/src/com/android/settings/network/AirplaneSafeNetworksPreferenceController.java b/src/com/android/settings/network/WifiSwitchPreferenceController.java
similarity index 74%
rename from src/com/android/settings/network/AirplaneSafeNetworksPreferenceController.java
rename to src/com/android/settings/network/WifiSwitchPreferenceController.java
index fa80c38..2ee407a 100644
--- a/src/com/android/settings/network/AirplaneSafeNetworksPreferenceController.java
+++ b/src/com/android/settings/network/WifiSwitchPreferenceController.java
@@ -23,41 +23,41 @@
import androidx.lifecycle.OnLifecycleEvent;
import androidx.preference.PreferenceScreen;
-import com.android.settings.AirplaneModeEnabler;
import com.android.settings.overlay.FeatureFactory;
import com.android.settings.widget.GenericSwitchController;
import com.android.settings.wifi.WifiEnabler;
import com.android.settingslib.RestrictedSwitchPreference;
import com.android.settingslib.core.AbstractPreferenceController;
-public class AirplaneSafeNetworksPreferenceController extends AbstractPreferenceController
- implements LifecycleObserver, AirplaneModeEnabler.OnAirplaneModeChangedListener {
+/**
+ * This controller helps to manage the state of wifi switch preference.
+ */
+public class WifiSwitchPreferenceController extends AbstractPreferenceController implements
+ LifecycleObserver {
- private static final String PREFERENCE_KEY = "airplane_safe_networks";
+ public static final String KEY = "wifi_switch";
private RestrictedSwitchPreference mPreference;
- private AirplaneModeEnabler mAirplaneModeEnabler;
private WifiEnabler mWifiEnabler;
- public AirplaneSafeNetworksPreferenceController(Context context, Lifecycle lifecycle) {
+ public WifiSwitchPreferenceController(Context context, Lifecycle lifecycle) {
super(context);
if (lifecycle == null) {
throw new IllegalArgumentException("Lifecycle must be set");
}
- mAirplaneModeEnabler = new AirplaneModeEnabler(mContext, this);
lifecycle.addObserver(this);
}
@Override
public String getPreferenceKey() {
- return PREFERENCE_KEY;
+ return KEY;
}
@Override
public boolean isAvailable() {
- return mAirplaneModeEnabler.isAirplaneModeOn();
+ return true;
}
@Override
@@ -66,23 +66,24 @@
mPreference = screen.findPreference(getPreferenceKey());
}
+ /** Lifecycle.Event.ON_START */
@OnLifecycleEvent(Lifecycle.Event.ON_START)
public void onStart() {
- mAirplaneModeEnabler.start();
if (mPreference != null) {
mWifiEnabler = new WifiEnabler(mContext, new GenericSwitchController(mPreference),
FeatureFactory.getFactory(mContext).getMetricsFeatureProvider());
}
}
+ /** Lifecycle.Event.ON_STOP */
@OnLifecycleEvent(Lifecycle.Event.ON_STOP)
public void onStop() {
- mAirplaneModeEnabler.stop();
if (mWifiEnabler != null) {
mWifiEnabler.teardownSwitchController();
}
}
+ /** Lifecycle.Event.ON_RESUME */
@OnLifecycleEvent(Lifecycle.Event.ON_RESUME)
public void onResume() {
if (mWifiEnabler != null) {
@@ -90,17 +91,11 @@
}
}
+ /** Lifecycle.Event.ON_PAUSE */
@OnLifecycleEvent(Lifecycle.Event.ON_PAUSE)
public void onPause() {
if (mWifiEnabler != null) {
mWifiEnabler.pause();
}
}
-
- @Override
- public void onAirplaneModeChanged(boolean isAirplaneModeOn) {
- if (mPreference != null) {
- mPreference.setVisible(isAirplaneModeOn);
- }
- }
}
diff --git a/src/com/android/settings/overlay/FeatureFactory.java b/src/com/android/settings/overlay/FeatureFactory.java
index a15075e..42d98e0 100644
--- a/src/com/android/settings/overlay/FeatureFactory.java
+++ b/src/com/android/settings/overlay/FeatureFactory.java
@@ -25,6 +25,7 @@
import com.android.settings.R;
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.biometrics.face.FaceFeatureProvider;
import com.android.settings.bluetooth.BluetoothFeatureProvider;
@@ -149,6 +150,11 @@
*/
public abstract WifiTrackerLibProvider getWifiTrackerLibProvider();
+ /**
+ * Retrieve implementation for Extra App Info feature.
+ */
+ public abstract ExtraAppInfoFeatureProvider getExtraAppInfoFeatureProvider();
+
public static final class FactoryNotFoundException extends RuntimeException {
public FactoryNotFoundException(Throwable throwable) {
super("Unable to create factory. Did you misconfigure Proguard?", throwable);
diff --git a/src/com/android/settings/overlay/FeatureFactoryImpl.java b/src/com/android/settings/overlay/FeatureFactoryImpl.java
index a1b70d9..46b263a 100644
--- a/src/com/android/settings/overlay/FeatureFactoryImpl.java
+++ b/src/com/android/settings/overlay/FeatureFactoryImpl.java
@@ -29,6 +29,8 @@
import com.android.settings.accounts.AccountFeatureProviderImpl;
import com.android.settings.applications.ApplicationFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProviderImpl;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProviderImpl;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.aware.AwareFeatureProviderImpl;
import com.android.settings.biometrics.face.FaceFeatureProvider;
@@ -94,6 +96,7 @@
private AwareFeatureProvider mAwareFeatureProvider;
private FaceFeatureProvider mFaceFeatureProvider;
private WifiTrackerLibProvider mWifiTrackerLibProvider;
+ private ExtraAppInfoFeatureProvider mExtraAppInfoFeatureProvider;
@Override
public SupportFeatureProvider getSupportFeatureProvider(Context context) {
@@ -291,4 +294,12 @@
}
return mWifiTrackerLibProvider;
}
+
+ @Override
+ public ExtraAppInfoFeatureProvider getExtraAppInfoFeatureProvider() {
+ if (mExtraAppInfoFeatureProvider == null) {
+ mExtraAppInfoFeatureProvider = new ExtraAppInfoFeatureProviderImpl();
+ }
+ return mExtraAppInfoFeatureProvider;
+ }
}
diff --git a/tests/robotests/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceControllerTest.java
new file mode 100644
index 0000000..f413908
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/applications/appinfo/ExtraAppInfoPreferenceControllerTest.java
@@ -0,0 +1,46 @@
+/*
+ * 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.
+ */
+
+package com.android.settings.applications.appinfo;
+
+import static com.android.settings.core.BasePreferenceController.UNSUPPORTED_ON_DEVICE;
+
+import static com.google.common.truth.Truth.assertThat;
+
+import android.content.Context;
+
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.robolectric.RobolectricTestRunner;
+import org.robolectric.RuntimeEnvironment;
+
+@RunWith(RobolectricTestRunner.class)
+public class ExtraAppInfoPreferenceControllerTest {
+ private Context mContext;
+ private ExtraAppInfoPreferenceController mController;
+
+ @Before
+ public void setUp() {
+ mContext = RuntimeEnvironment.application;
+ mController = new ExtraAppInfoPreferenceController(mContext, "test_key");
+ }
+
+ @Test
+ public void getAvailabilityStatus_unavailableByDefault() {
+ assertThat(mController.getAvailabilityStatus()).isEqualTo(UNSUPPORTED_ON_DEVICE);
+ }
+}
diff --git a/tests/robotests/src/com/android/settings/applications/assist/OWNERS b/tests/robotests/src/com/android/settings/applications/assist/OWNERS
new file mode 100644
index 0000000..bf069f4
--- /dev/null
+++ b/tests/robotests/src/com/android/settings/applications/assist/OWNERS
@@ -0,0 +1 @@
+include /src/com/android/settings/applications/assist/OWNERS
diff --git a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
index 6fb2eae..a48b3eb 100644
--- a/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/robotests/src/com/android/settings/testutils/FakeFeatureFactory.java
@@ -23,6 +23,7 @@
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.biometrics.face.FaceFeatureProvider;
import com.android.settings.bluetooth.BluetoothFeatureProvider;
@@ -79,6 +80,7 @@
public ContextualCardFeatureProvider mContextualCardFeatureProvider;
public WifiTrackerLibProvider wifiTrackerLibProvider;
+ public ExtraAppInfoFeatureProvider extraAppInfoFeatureProvider;
/**
* Call this in {@code @Before} method of the test class to use fake factory.
@@ -124,6 +126,7 @@
mAwareFeatureProvider = mock(AwareFeatureProvider.class);
mFaceFeatureProvider = mock(FaceFeatureProvider.class);
wifiTrackerLibProvider = mock(WifiTrackerLibProvider.class);
+ extraAppInfoFeatureProvider = mock(ExtraAppInfoFeatureProvider.class);
}
@Override
@@ -240,4 +243,9 @@
public WifiTrackerLibProvider getWifiTrackerLibProvider() {
return wifiTrackerLibProvider;
}
+
+ @Override
+ public ExtraAppInfoFeatureProvider getExtraAppInfoFeatureProvider() {
+ return extraAppInfoFeatureProvider;
+ }
}
diff --git a/tests/unit/src/com/android/settings/applications/autofill/OWNERS b/tests/unit/src/com/android/settings/applications/autofill/OWNERS
new file mode 100644
index 0000000..fe93c13
--- /dev/null
+++ b/tests/unit/src/com/android/settings/applications/autofill/OWNERS
@@ -0,0 +1 @@
+include /src/com/android/settings/applications/autofill/OWNERS
diff --git a/tests/unit/src/com/android/settings/network/AirplaneSafeNetworksPreferenceControllerTest.java b/tests/unit/src/com/android/settings/network/WifiSwitchPreferenceControllerTest.java
similarity index 71%
rename from tests/unit/src/com/android/settings/network/AirplaneSafeNetworksPreferenceControllerTest.java
rename to tests/unit/src/com/android/settings/network/WifiSwitchPreferenceControllerTest.java
index 4c4c5bd..1244db8 100644
--- a/tests/unit/src/com/android/settings/network/AirplaneSafeNetworksPreferenceControllerTest.java
+++ b/tests/unit/src/com/android/settings/network/WifiSwitchPreferenceControllerTest.java
@@ -22,11 +22,9 @@
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
-import android.content.ContentResolver;
import android.content.Context;
import android.net.wifi.WifiManager;
import android.os.Looper;
-import android.provider.Settings;
import androidx.preference.PreferenceManager;
import androidx.preference.PreferenceScreen;
@@ -43,17 +41,11 @@
import org.mockito.MockitoAnnotations;
@RunWith(AndroidJUnit4.class)
-public class AirplaneSafeNetworksPreferenceControllerTest {
+public class WifiSwitchPreferenceControllerTest {
- private static final String KEY_AIRPLANE_SAFE_NETWORKS = "airplane_safe_networks";
-
- private static final int ON = 1;
- private static final int OFF = 0;
-
- private ContentResolver mResolver;
private PreferenceScreen mScreen;
private RestrictedSwitchPreference mPreference;
- private AirplaneSafeNetworksPreferenceController mController;
+ private WifiSwitchPreferenceController mController;
@Mock
private WifiManager mWifiManager;
@@ -62,37 +54,21 @@
public void setUp() {
MockitoAnnotations.initMocks(this);
final Context context = spy(ApplicationProvider.getApplicationContext());
- mResolver = context.getContentResolver();
doReturn(mWifiManager).when(context).getSystemService(Context.WIFI_SERVICE);
- mController = new AirplaneSafeNetworksPreferenceController(context, mock(Lifecycle.class));
+ mController = new WifiSwitchPreferenceController(context, mock(Lifecycle.class));
if (Looper.myLooper() == null) {
Looper.prepare();
}
final PreferenceManager preferenceManager = new PreferenceManager(context);
mScreen = preferenceManager.createPreferenceScreen(context);
mPreference = new RestrictedSwitchPreference(context);
- mPreference.setKey(KEY_AIRPLANE_SAFE_NETWORKS);
+ mPreference.setKey(WifiSwitchPreferenceController.KEY);
mScreen.addPreference(mPreference);
}
@Test
- public void isAvailable_airplaneModeOff_returnFalse() {
- Settings.Global.putInt(mResolver, Settings.Global.AIRPLANE_MODE_ON, OFF);
-
- mController.displayPreference(mScreen);
- mController.onStart();
-
- assertThat(mController.isAvailable()).isFalse();
- }
-
- @Test
- public void isAvailable_airplaneModeOn_returnTrue() {
- Settings.Global.putInt(mResolver, Settings.Global.AIRPLANE_MODE_ON, ON);
-
- mController.displayPreference(mScreen);
- mController.onStart();
-
+ public void isAvailable_returnTrue() {
assertThat(mController.isAvailable()).isTrue();
}
diff --git a/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java b/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
index d20fc12..6955dc4 100644
--- a/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
+++ b/tests/unit/src/com/android/settings/testutils/FakeFeatureFactory.java
@@ -21,6 +21,7 @@
import com.android.settings.accounts.AccountFeatureProvider;
import com.android.settings.applications.ApplicationFeatureProvider;
+import com.android.settings.applications.appinfo.ExtraAppInfoFeatureProvider;
import com.android.settings.aware.AwareFeatureProvider;
import com.android.settings.biometrics.face.FaceFeatureProvider;
import com.android.settings.bluetooth.BluetoothFeatureProvider;
@@ -74,6 +75,7 @@
public ContextualCardFeatureProvider mContextualCardFeatureProvider;
public WifiTrackerLibProvider wifiTrackerLibProvider;
+ public ExtraAppInfoFeatureProvider extraAppInfoFeatureProvider;
/**
* Call this in {@code @Before} method of the test class to use fake factory.
@@ -110,6 +112,7 @@
mAwareFeatureProvider = mock(AwareFeatureProvider.class);
mFaceFeatureProvider = mock(FaceFeatureProvider.class);
wifiTrackerLibProvider = mock(WifiTrackerLibProvider.class);
+ extraAppInfoFeatureProvider = mock(ExtraAppInfoFeatureProvider.class);
}
@Override
@@ -226,4 +229,9 @@
public WifiTrackerLibProvider getWifiTrackerLibProvider() {
return wifiTrackerLibProvider;
}
+
+ @Override
+ public ExtraAppInfoFeatureProvider getExtraAppInfoFeatureProvider() {
+ return extraAppInfoFeatureProvider;
+ }
}