Use resource processor for Settings
Bug: 293810334 Test: m Settings Test: robotests Change-Id: Ie515e137648eddfdfcab5e8095f5be99721d9e1b
This commit is contained in:
@@ -55,6 +55,7 @@ android_library {
|
|||||||
],
|
],
|
||||||
|
|
||||||
srcs: ["src/**/*.java", "src/**/*.kt"],
|
srcs: ["src/**/*.java", "src/**/*.kt"],
|
||||||
|
use_resource_processor: true,
|
||||||
resource_dirs: [
|
resource_dirs: [
|
||||||
"res",
|
"res",
|
||||||
"res-export", // for external usage
|
"res-export", // for external usage
|
||||||
@@ -136,6 +137,7 @@ android_app {
|
|||||||
],
|
],
|
||||||
static_libs: ["Settings-core"],
|
static_libs: ["Settings-core"],
|
||||||
uses_libs: ["org.apache.http.legacy"],
|
uses_libs: ["org.apache.http.legacy"],
|
||||||
|
use_resource_processor: true,
|
||||||
resource_dirs: [],
|
resource_dirs: [],
|
||||||
optimize: {
|
optimize: {
|
||||||
proguard_flags_files: ["proguard.flags"],
|
proguard_flags_files: ["proguard.flags"],
|
||||||
|
@@ -50,9 +50,9 @@ import com.google.android.setupdesign.template.RequireScrollMixin
|
|||||||
import com.google.android.setupdesign.util.DeviceHelper
|
import com.google.android.setupdesign.util.DeviceHelper
|
||||||
import com.google.android.setupdesign.util.DynamicColorPalette
|
import com.google.android.setupdesign.util.DynamicColorPalette
|
||||||
import com.google.android.setupdesign.util.DynamicColorPalette.ColorType.ACCENT
|
import com.google.android.setupdesign.util.DynamicColorPalette.ColorType.ACCENT
|
||||||
|
import java.util.function.Supplier
|
||||||
import kotlinx.coroutines.flow.first
|
import kotlinx.coroutines.flow.first
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import java.util.function.Supplier
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Fingerprint intro onboarding page fragment implementation
|
* Fingerprint intro onboarding page fragment implementation
|
||||||
@@ -324,6 +324,6 @@ fun FragmentActivity.bindFingerprintEnrollIntroView(
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
view.findViewById<ScrollView>(R.id.sud_scroll_view)?.importantForAccessibility =
|
view.findViewById<ScrollView>(com.google.android.setupdesign.R.id.sud_scroll_view)
|
||||||
View.IMPORTANT_FOR_ACCESSIBILITY_YES
|
?.importantForAccessibility = View.IMPORTANT_FOR_ACCESSIBILITY_YES
|
||||||
}
|
}
|
||||||
|
@@ -18,12 +18,10 @@ package com.android.settings.remoteauth.finish
|
|||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.view.View
|
import android.view.View
|
||||||
|
import com.airbnb.lottie.LottieAnimationView
|
||||||
import com.android.settings.R
|
import com.android.settings.R
|
||||||
import com.android.settings.remoteauth.RemoteAuthEnrollBase
|
import com.android.settings.remoteauth.RemoteAuthEnrollBase
|
||||||
import com.android.settingslib.widget.LottieColorUtils
|
import com.android.settingslib.widget.LottieColorUtils
|
||||||
|
|
||||||
import com.airbnb.lottie.LottieAnimationView
|
|
||||||
import com.google.android.setupcompat.template.FooterButton
|
import com.google.android.setupcompat.template.FooterButton
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -45,7 +43,7 @@ class RemoteAuthEnrollFinish :
|
|||||||
.setText(R.string.security_settings_remoteauth_enroll_finish_btn_next)
|
.setText(R.string.security_settings_remoteauth_enroll_finish_btn_next)
|
||||||
.setListener(this::onPrimaryFooterButtonClick)
|
.setListener(this::onPrimaryFooterButtonClick)
|
||||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
.setTheme(R.style.SudGlifButton_Primary)
|
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -49,7 +49,7 @@ class RemoteAuthEnrollIntroduction :
|
|||||||
.setText(R.string.security_settings_remoteauth_enroll_introduction_agree)
|
.setText(R.string.security_settings_remoteauth_enroll_introduction_agree)
|
||||||
.setListener(::onPrimaryFooterButtonClick)
|
.setListener(::onPrimaryFooterButtonClick)
|
||||||
.setButtonType(FooterButton.ButtonType.OPT_IN)
|
.setButtonType(FooterButton.ButtonType.OPT_IN)
|
||||||
.setTheme(R.style.SudGlifButton_Primary)
|
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -58,7 +58,7 @@ class RemoteAuthEnrollIntroduction :
|
|||||||
.setText(R.string.security_settings_remoteauth_enroll_introduction_disagree)
|
.setText(R.string.security_settings_remoteauth_enroll_introduction_disagree)
|
||||||
.setListener(::onSecondaryFooterButtonClick)
|
.setListener(::onSecondaryFooterButtonClick)
|
||||||
.setButtonType(FooterButton.ButtonType.NEXT)
|
.setButtonType(FooterButton.ButtonType.NEXT)
|
||||||
.setTheme(R.style.SudGlifButton_Primary)
|
.setTheme(com.google.android.setupdesign.R.style.SudGlifButton_Primary)
|
||||||
.build()
|
.build()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -86,8 +86,8 @@ public class SearchMenuController implements LifecycleObserver, OnCreateOptionsM
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
final MenuItem searchItem = menu.add(Menu.NONE, MENU_SEARCH, 0 /* order */,
|
final MenuItem searchItem = menu.add(Menu.NONE, MENU_SEARCH, 0 /* order */,
|
||||||
R.string.search_menu);
|
com.android.settingslib.search.R.string.search_menu);
|
||||||
searchItem.setIcon(R.drawable.ic_search_24dp);
|
searchItem.setIcon(com.android.settingslib.search.R.drawable.ic_search_24dp);
|
||||||
searchItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
searchItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
|
||||||
|
|
||||||
searchItem.setOnMenuItemClickListener(target -> {
|
searchItem.setOnMenuItemClickListener(target -> {
|
||||||
|
@@ -1,7 +1,3 @@
|
|||||||
//############################################################
|
|
||||||
// Build SettingsRoboTestStub.apk which includes test-only resources.#
|
|
||||||
//############################################################
|
|
||||||
|
|
||||||
package {
|
package {
|
||||||
// See: http://go/android-license-faq
|
// See: http://go/android-license-faq
|
||||||
// A large-scale-change added 'default_applicable_licenses' to import
|
// A large-scale-change added 'default_applicable_licenses' to import
|
||||||
@@ -11,6 +7,7 @@ package {
|
|||||||
default_applicable_licenses: ["packages_apps_Settings_license"],
|
default_applicable_licenses: ["packages_apps_Settings_license"],
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Build SettingsRoboTestStub.apk which includes test-only resources.
|
||||||
android_app {
|
android_app {
|
||||||
name: "SettingsRoboTestStub",
|
name: "SettingsRoboTestStub",
|
||||||
defaults: [
|
defaults: [
|
||||||
@@ -25,33 +22,8 @@ android_app {
|
|||||||
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"Settings-core",
|
"Settings-core",
|
||||||
"androidx-constraintlayout_constraintlayout",
|
|
||||||
"androidx.slice_slice-builders",
|
|
||||||
"androidx.slice_slice-core",
|
|
||||||
"androidx.slice_slice-view",
|
|
||||||
"androidx.core_core",
|
|
||||||
"androidx.appcompat_appcompat",
|
|
||||||
"androidx.cardview_cardview",
|
|
||||||
"androidx.fragment_fragment-testing",
|
"androidx.fragment_fragment-testing",
|
||||||
"androidx.preference_preference",
|
|
||||||
"androidx.recyclerview_recyclerview",
|
|
||||||
"androidx.window_window",
|
|
||||||
"com.google.android.material_material",
|
|
||||||
"setupcompat",
|
|
||||||
"setupdesign",
|
|
||||||
"androidx.lifecycle_lifecycle-runtime",
|
|
||||||
"androidx.test.core",
|
|
||||||
"androidx.test.runner",
|
|
||||||
"androidx.test.ext.junit",
|
|
||||||
"frameworks-base-testutils",
|
"frameworks-base-testutils",
|
||||||
"guava",
|
|
||||||
"jsr305",
|
|
||||||
"settings-contextual-card-protos-lite",
|
|
||||||
"settings-log-bridge-protos-lite",
|
|
||||||
"settings-telephony-protos-lite",
|
|
||||||
"contextualcards",
|
|
||||||
"settings-logtags",
|
|
||||||
"zxing-core-1.7",
|
|
||||||
],
|
],
|
||||||
|
|
||||||
aaptflags: ["--extra-packages com.android.settings"],
|
aaptflags: ["--extra-packages com.android.settings"],
|
||||||
@@ -67,9 +39,7 @@ android_app {
|
|||||||
],
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
//############################################################
|
// Settings Robolectric test target.
|
||||||
// Settings Robolectric test target. #
|
|
||||||
//############################################################
|
|
||||||
android_robolectric_test {
|
android_robolectric_test {
|
||||||
name: "SettingsRoboTests",
|
name: "SettingsRoboTests",
|
||||||
srcs: [
|
srcs: [
|
||||||
@@ -79,12 +49,12 @@ android_robolectric_test {
|
|||||||
|
|
||||||
static_libs: [
|
static_libs: [
|
||||||
"SettingsLib-robo-testutils",
|
"SettingsLib-robo-testutils",
|
||||||
"android-support-annotations",
|
"Settings-robo-testutils",
|
||||||
"androidx.test.core",
|
"androidx.test.core",
|
||||||
|
"androidx.test.espresso.core",
|
||||||
|
"androidx.test.ext.junit",
|
||||||
"androidx.test.rules",
|
"androidx.test.rules",
|
||||||
"androidx.test.runner",
|
"androidx.test.runner",
|
||||||
"androidx.test.ext.junit",
|
|
||||||
"androidx.test.espresso.core",
|
|
||||||
],
|
],
|
||||||
|
|
||||||
libs: [
|
libs: [
|
||||||
@@ -109,7 +79,7 @@ android_robolectric_test {
|
|||||||
|
|
||||||
java_library {
|
java_library {
|
||||||
name: "Settings-robo-testutils",
|
name: "Settings-robo-testutils",
|
||||||
srcs: ["src/com/android/settings/testutils/**/*.java"],
|
srcs: ["testutils/**/*.java"],
|
||||||
|
|
||||||
libs: [
|
libs: [
|
||||||
"Settings-core",
|
"Settings-core",
|
||||||
|
@@ -35,21 +35,29 @@ class RemoteAuthEnrollFinishTest {
|
|||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRemoteAuthenticatorEnrollFinish_hasHeader() {
|
fun testRemoteAuthenticatorEnrollFinish_hasHeader() {
|
||||||
launchFragmentInContainer<RemoteAuthEnrollFinish>(Bundle(), R.style.SudThemeGlif)
|
launchFragmentInContainer<RemoteAuthEnrollFinish>(
|
||||||
.onFragment {
|
Bundle(),
|
||||||
assertThat((it.view as GlifLayout).headerText)
|
com.google.android.setupdesign.R.style.SudThemeGlif,
|
||||||
.isEqualTo(mContext.getString(
|
).onFragment {
|
||||||
R.string.security_settings_remoteauth_enroll_finish_title))
|
assertThat((it.view as GlifLayout).headerText)
|
||||||
}
|
.isEqualTo(
|
||||||
|
mContext.getString(R.string.security_settings_remoteauth_enroll_finish_title)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRemoteAuthenticatorEnrollFinish_hasDescription() {
|
fun testRemoteAuthenticatorEnrollFinish_hasDescription() {
|
||||||
launchFragmentInContainer<RemoteAuthEnrollFinish>(Bundle(), R.style.SudThemeGlif)
|
launchFragmentInContainer<RemoteAuthEnrollFinish>(
|
||||||
.onFragment {
|
Bundle(),
|
||||||
assertThat((it.view as GlifLayout).descriptionText)
|
com.google.android.setupdesign.R.style.SudThemeGlif,
|
||||||
.isEqualTo(mContext.getString(
|
).onFragment {
|
||||||
R.string.security_settings_remoteauth_enroll_finish_description))
|
assertThat((it.view as GlifLayout).descriptionText)
|
||||||
}
|
.isEqualTo(
|
||||||
|
mContext.getString(
|
||||||
|
R.string.security_settings_remoteauth_enroll_finish_description
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -30,23 +30,31 @@ import org.robolectric.RobolectricTestRunner
|
|||||||
|
|
||||||
@RunWith(RobolectricTestRunner::class)
|
@RunWith(RobolectricTestRunner::class)
|
||||||
class RemoteAuthEnrollIntroductionTest {
|
class RemoteAuthEnrollIntroductionTest {
|
||||||
private var mContext : Context = ApplicationProvider.getApplicationContext()
|
private var mContext: Context = ApplicationProvider.getApplicationContext()
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRemoteAuthenticatorEnrollIntroduction_hasHeader() {
|
fun testRemoteAuthenticatorEnrollIntroduction_hasHeader() {
|
||||||
launchFragmentInContainer<RemoteAuthEnrollIntroduction>(Bundle(), R.style.SudThemeGlif)
|
launchFragmentInContainer<RemoteAuthEnrollIntroduction>(
|
||||||
.onFragment {
|
Bundle(),
|
||||||
assertThat((it.view as GlifLayout).headerText)
|
com.google.android.setupdesign.R.style.SudThemeGlif,
|
||||||
.isEqualTo(mContext.getString(R.string.security_settings_remoteauth_enroll_introduction_title))
|
).onFragment {
|
||||||
}
|
assertThat((it.view as GlifLayout).headerText)
|
||||||
|
.isEqualTo(mContext.getString(R.string.security_settings_remoteauth_enroll_introduction_title))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun testRemoteAuthenticatorEnrollIntroduction_hasDescription() {
|
fun testRemoteAuthenticatorEnrollIntroduction_hasDescription() {
|
||||||
launchFragmentInContainer<RemoteAuthEnrollIntroduction>(Bundle(), R.style.SudThemeGlif)
|
launchFragmentInContainer<RemoteAuthEnrollIntroduction>(
|
||||||
.onFragment {
|
Bundle(),
|
||||||
assertThat((it.view as GlifLayout).descriptionText)
|
com.google.android.setupdesign.R.style.SudThemeGlif,
|
||||||
.isEqualTo(mContext.getString(R.string.security_settings_remoteauth_enroll_introduction_message))
|
).onFragment {
|
||||||
}
|
assertThat((it.view as GlifLayout).descriptionText)
|
||||||
|
.isEqualTo(
|
||||||
|
mContext.getString(
|
||||||
|
R.string.security_settings_remoteauth_enroll_introduction_message
|
||||||
|
)
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -33,7 +33,6 @@ import android.view.MenuItem;
|
|||||||
|
|
||||||
import androidx.fragment.app.FragmentActivity;
|
import androidx.fragment.app.FragmentActivity;
|
||||||
|
|
||||||
import com.android.settings.R;
|
|
||||||
import com.android.settings.core.InstrumentedFragment;
|
import com.android.settings.core.InstrumentedFragment;
|
||||||
import com.android.settings.testutils.shadow.ShadowUtils;
|
import com.android.settings.testutils.shadow.ShadowUtils;
|
||||||
|
|
||||||
@@ -72,7 +71,7 @@ public class SearchMenuControllerTest {
|
|||||||
|
|
||||||
when(mHost.getActivity()).thenReturn(mActivity);
|
when(mHost.getActivity()).thenReturn(mActivity);
|
||||||
when(mMenu.add(Menu.NONE, MENU_SEARCH, 0 /* order */,
|
when(mMenu.add(Menu.NONE, MENU_SEARCH, 0 /* order */,
|
||||||
R.string.search_menu))
|
com.android.settingslib.search.R.string.search_menu))
|
||||||
.thenReturn(mock(MenuItem.class));
|
.thenReturn(mock(MenuItem.class));
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -82,7 +81,7 @@ public class SearchMenuControllerTest {
|
|||||||
mHost.getSettingsLifecycle().onCreateOptionsMenu(mMenu, null /* inflater */);
|
mHost.getSettingsLifecycle().onCreateOptionsMenu(mMenu, null /* inflater */);
|
||||||
|
|
||||||
verify(mMenu).add(Menu.NONE, MENU_SEARCH, 0 /* order */,
|
verify(mMenu).add(Menu.NONE, MENU_SEARCH, 0 /* order */,
|
||||||
R.string.search_menu);
|
com.android.settingslib.search.R.string.search_menu);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.android.settings.testutils.shadow;
|
|
||||||
|
|
||||||
import com.android.settings.applications.AppInfoBase;
|
|
||||||
|
|
||||||
import org.robolectric.annotation.Implementation;
|
|
||||||
import org.robolectric.annotation.Implements;
|
|
||||||
|
|
||||||
@Implements(AppInfoBase.class)
|
|
||||||
public class ShadowAppInfoBase {
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected void onResume() {
|
|
||||||
// No-op.
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected void onPause() {
|
|
||||||
// No-op.
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 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.shadow;
|
|
||||||
|
|
||||||
import android.os.Looper;
|
|
||||||
|
|
||||||
import com.android.settingslib.applications.ApplicationsState;
|
|
||||||
|
|
||||||
import org.robolectric.annotation.Implementation;
|
|
||||||
import org.robolectric.annotation.Implements;
|
|
||||||
|
|
||||||
@Implements(ApplicationsState.class)
|
|
||||||
public class ShadowApplicationsState {
|
|
||||||
@Implementation
|
|
||||||
protected Looper getBackgroundLooper() {
|
|
||||||
return Looper.getMainLooper();
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,22 +0,0 @@
|
|||||||
package com.android.settings.testutils.shadow;
|
|
||||||
|
|
||||||
import com.android.settings.datausage.DataSaverBackend;
|
|
||||||
|
|
||||||
import org.robolectric.annotation.Implementation;
|
|
||||||
import org.robolectric.annotation.Implements;
|
|
||||||
|
|
||||||
@Implements(DataSaverBackend.class)
|
|
||||||
public class ShadowDataSaverBackend {
|
|
||||||
|
|
||||||
private static boolean isEnabled = true;
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected boolean isDataSaverEnabled() {
|
|
||||||
return isEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected void setDataSaverEnabled(boolean enabled) {
|
|
||||||
isEnabled = enabled;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 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.shadow;
|
|
||||||
|
|
||||||
import static org.robolectric.util.ReflectionHelpers.ClassParameter.from;
|
|
||||||
|
|
||||||
import android.hardware.input.IInputManager;
|
|
||||||
import android.hardware.input.InputManager;
|
|
||||||
import android.os.Handler;
|
|
||||||
|
|
||||||
import org.robolectric.annotation.Implementation;
|
|
||||||
import org.robolectric.annotation.Implements;
|
|
||||||
import org.robolectric.util.ReflectionHelpers;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shadow for {@link InputManager} that has accessors for registered
|
|
||||||
* {@link InputManager.InputDeviceListener}s.
|
|
||||||
*/
|
|
||||||
@Implements(value = InputManager.class, callThroughByDefault = false)
|
|
||||||
public class ShadowInputManager {
|
|
||||||
|
|
||||||
private List<InputManager.InputDeviceListener> mInputDeviceListeners;
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected void __constructor__(IInputManager service) {
|
|
||||||
mInputDeviceListeners = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected static InputManager getInstance() {
|
|
||||||
return ReflectionHelpers.callConstructor(
|
|
||||||
InputManager.class,
|
|
||||||
from(IInputManager.class, null));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected void registerInputDeviceListener(InputManager.InputDeviceListener listener,
|
|
||||||
Handler handler) {
|
|
||||||
// TODO: Use handler.
|
|
||||||
if (!mInputDeviceListeners.contains(listener)) {
|
|
||||||
mInputDeviceListeners.add(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected void unregisterInputDeviceListener(InputManager.InputDeviceListener listener) {
|
|
||||||
mInputDeviceListeners.remove(listener);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,60 +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.shadow;
|
|
||||||
|
|
||||||
import static org.mockito.Mockito.mock;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.net.ConnectivityManager;
|
|
||||||
import android.net.NetworkScoreManager;
|
|
||||||
import android.net.wifi.WifiManager;
|
|
||||||
import android.os.Handler;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.lifecycle.Lifecycle;
|
|
||||||
|
|
||||||
import com.android.wifitrackerlib.NetworkDetailsTracker;
|
|
||||||
import com.android.wifitrackerlib.WifiEntry;
|
|
||||||
|
|
||||||
import org.robolectric.annotation.Implementation;
|
|
||||||
import org.robolectric.annotation.Implements;
|
|
||||||
|
|
||||||
import java.time.Clock;
|
|
||||||
|
|
||||||
@Implements(NetworkDetailsTracker.class)
|
|
||||||
public class ShadowNetworkDetailsTracker {
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
public static NetworkDetailsTracker createNetworkDetailsTracker(@NonNull Lifecycle lifecycle,
|
|
||||||
@NonNull Context context,
|
|
||||||
@NonNull WifiManager wifiManager,
|
|
||||||
@NonNull ConnectivityManager connectivityManager,
|
|
||||||
@NonNull NetworkScoreManager networkScoreManager,
|
|
||||||
@NonNull Handler mainHandler,
|
|
||||||
@NonNull Handler workerHandler,
|
|
||||||
@NonNull Clock clock,
|
|
||||||
long maxScanAgeMillis,
|
|
||||||
long scanIntervalMillis,
|
|
||||||
String key) {
|
|
||||||
return mock(NetworkDetailsTracker.class);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
public WifiEntry getWifiEntry() {
|
|
||||||
return mock(WifiEntry.class);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,45 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2019 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.shadow;
|
|
||||||
|
|
||||||
import android.annotation.CallbackExecutor;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.permission.PermissionControllerManager;
|
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import org.robolectric.annotation.Implementation;
|
|
||||||
import org.robolectric.annotation.Implements;
|
|
||||||
|
|
||||||
import java.util.concurrent.Executor;
|
|
||||||
|
|
||||||
@Implements(PermissionControllerManager.class)
|
|
||||||
public class ShadowPermissionControllerManager {
|
|
||||||
|
|
||||||
protected void __constructor__(Context contexts, Handler handler) {
|
|
||||||
// no nothing, everything is shadowed
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
public void getPermissionUsages(boolean countSystem, long numMillis,
|
|
||||||
@NonNull @CallbackExecutor Executor executor,
|
|
||||||
@NonNull PermissionControllerManager.OnPermissionUsageResultCallback callback) {
|
|
||||||
|
|
||||||
// Do nothing
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,93 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.android.settings.testutils.shadow;
|
|
||||||
|
|
||||||
import static org.robolectric.RuntimeEnvironment.application;
|
|
||||||
|
|
||||||
import android.net.wifi.ScanResult;
|
|
||||||
import android.net.wifi.SoftApConfiguration;
|
|
||||||
import android.net.wifi.WifiConfiguration;
|
|
||||||
import android.net.wifi.WifiManager;
|
|
||||||
import android.net.wifi.hotspot2.PasspointConfiguration;
|
|
||||||
|
|
||||||
import org.robolectric.annotation.HiddenApi;
|
|
||||||
import org.robolectric.annotation.Implementation;
|
|
||||||
import org.robolectric.annotation.Implements;
|
|
||||||
import org.robolectric.shadow.api.Shadow;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Implements(value = WifiManager.class)
|
|
||||||
public class ShadowWifiManager extends org.robolectric.shadows.ShadowWifiManager {
|
|
||||||
|
|
||||||
private List<PasspointConfiguration> mPasspointConfiguration;
|
|
||||||
|
|
||||||
public WifiConfiguration savedWifiConfig;
|
|
||||||
private SoftApConfiguration mSavedApConfig;
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected SoftApConfiguration getSoftApConfiguration() {
|
|
||||||
return mSavedApConfig;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected boolean setSoftApConfiguration(SoftApConfiguration softApConfig) {
|
|
||||||
mSavedApConfig = softApConfig;
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@HiddenApi // @SystemApi
|
|
||||||
@Implementation
|
|
||||||
protected void connect(WifiConfiguration config, WifiManager.ActionListener listener) {
|
|
||||||
savedWifiConfig = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@HiddenApi
|
|
||||||
@Implementation
|
|
||||||
protected void save(WifiConfiguration config, WifiManager.ActionListener listener) {
|
|
||||||
savedWifiConfig = config;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected List<PasspointConfiguration> getPasspointConfigurations() {
|
|
||||||
return mPasspointConfiguration == null ? Collections.emptyList() : mPasspointConfiguration;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected void addOrUpdatePasspointConfiguration(PasspointConfiguration config) {
|
|
||||||
if (mPasspointConfiguration == null) {
|
|
||||||
mPasspointConfiguration = new ArrayList<>();
|
|
||||||
}
|
|
||||||
mPasspointConfiguration.add(config);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected boolean isDualModeSupported() {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected List<ScanResult> getScanResults() {
|
|
||||||
return new ArrayList<ScanResult>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ShadowWifiManager get() {
|
|
||||||
return Shadow.extract(application.getSystemService(WifiManager.class));
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,55 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2018 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.shadow;
|
|
||||||
|
|
||||||
import android.net.wifi.p2p.WifiP2pManager;
|
|
||||||
|
|
||||||
import org.robolectric.annotation.Implementation;
|
|
||||||
import org.robolectric.annotation.Implements;
|
|
||||||
import org.robolectric.annotation.Resetter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shadow class for WifiP2pManager.
|
|
||||||
*/
|
|
||||||
@Implements(value = WifiP2pManager.class)
|
|
||||||
public class ShadowWifiP2pManager extends org.robolectric.shadows.ShadowWifiP2pManager {
|
|
||||||
|
|
||||||
private static int sFactoryResetCount;
|
|
||||||
|
|
||||||
@Implementation
|
|
||||||
protected void factoryReset(WifiP2pManager.Channel c, WifiP2pManager.ActionListener listener) {
|
|
||||||
if (c != null) {
|
|
||||||
sFactoryResetCount++;
|
|
||||||
} else {
|
|
||||||
throw new IllegalArgumentException("channel must be non-null.");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Resetter
|
|
||||||
public static void reset() {
|
|
||||||
sFactoryResetCount = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Return the count of factoryReset called.
|
|
||||||
*
|
|
||||||
* @return the count of factoryReset called.
|
|
||||||
*/
|
|
||||||
public static int getFactoryResetCount() {
|
|
||||||
return sFactoryResetCount;
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2016 The Android Open Source Project
|
* Copyright (C) 2023 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
* See the License for the specific language governing permissions and
|
* See the License for the specific language governing permissions and
|
||||||
* limitations under the License
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
package com.android.settings.testutils;
|
package com.android.settings.testutils;
|
||||||
|
|
||||||
@@ -23,7 +23,6 @@ import com.android.settings.accessibility.AccessibilityMetricsFeatureProvider;
|
|||||||
import com.android.settings.accessibility.AccessibilitySearchFeatureProvider;
|
import com.android.settings.accessibility.AccessibilitySearchFeatureProvider;
|
||||||
import com.android.settings.accounts.AccountFeatureProvider;
|
import com.android.settings.accounts.AccountFeatureProvider;
|
||||||
import com.android.settings.applications.ApplicationFeatureProvider;
|
import com.android.settings.applications.ApplicationFeatureProvider;
|
||||||
import com.android.settings.onboarding.OnboardingFeatureProvider;
|
|
||||||
import com.android.settings.biometrics.face.FaceFeatureProvider;
|
import com.android.settings.biometrics.face.FaceFeatureProvider;
|
||||||
import com.android.settings.biometrics2.factory.BiometricsRepositoryProvider;
|
import com.android.settings.biometrics2.factory.BiometricsRepositoryProvider;
|
||||||
import com.android.settings.bluetooth.BluetoothFeatureProvider;
|
import com.android.settings.bluetooth.BluetoothFeatureProvider;
|
||||||
@@ -39,6 +38,7 @@ import com.android.settings.fuelgauge.PowerUsageFeatureProvider;
|
|||||||
import com.android.settings.homepage.contextualcards.ContextualCardFeatureProvider;
|
import com.android.settings.homepage.contextualcards.ContextualCardFeatureProvider;
|
||||||
import com.android.settings.inputmethod.KeyboardSettingsFeatureProvider;
|
import com.android.settings.inputmethod.KeyboardSettingsFeatureProvider;
|
||||||
import com.android.settings.localepicker.LocaleFeatureProvider;
|
import com.android.settings.localepicker.LocaleFeatureProvider;
|
||||||
|
import com.android.settings.onboarding.OnboardingFeatureProvider;
|
||||||
import com.android.settings.overlay.DockUpdaterFeatureProvider;
|
import com.android.settings.overlay.DockUpdaterFeatureProvider;
|
||||||
import com.android.settings.overlay.FeatureFactory;
|
import com.android.settings.overlay.FeatureFactory;
|
||||||
import com.android.settings.overlay.SupportFeatureProvider;
|
import com.android.settings.overlay.SupportFeatureProvider;
|
@@ -1,3 +1,19 @@
|
|||||||
|
/*
|
||||||
|
* Copyright (C) 2023 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.shadow;
|
package com.android.settings.testutils.shadow;
|
||||||
|
|
||||||
import static org.robolectric.RuntimeEnvironment.application;
|
import static org.robolectric.RuntimeEnvironment.application;
|
@@ -38,39 +38,40 @@ public class ShadowAlertDialogCompat extends ShadowDialog {
|
|||||||
|
|
||||||
@SuppressLint("StaticFieldLeak")
|
@SuppressLint("StaticFieldLeak")
|
||||||
@Nullable
|
@Nullable
|
||||||
private static ShadowAlertDialogCompat latestSupportAlertDialog;
|
private static ShadowAlertDialogCompat sLatestSupportAlertDialog;
|
||||||
@RealObject
|
@RealObject
|
||||||
private AlertDialog realAlertDialog;
|
private AlertDialog mRealAlertDialog;
|
||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
public void show() {
|
public void show() {
|
||||||
super.show();
|
super.show();
|
||||||
latestSupportAlertDialog = this;
|
sLatestSupportAlertDialog = this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence getMessage() {
|
public CharSequence getMessage() {
|
||||||
final Object alertController = ReflectionHelpers.getField(realAlertDialog, "mAlert");
|
final Object alertController = ReflectionHelpers.getField(mRealAlertDialog, "mAlert");
|
||||||
return ReflectionHelpers.getField(alertController, "mMessage");
|
return ReflectionHelpers.getField(alertController, "mMessage");
|
||||||
}
|
}
|
||||||
|
|
||||||
public CharSequence getTitle() {
|
public CharSequence getTitle() {
|
||||||
final Object alertController = ReflectionHelpers.getField(realAlertDialog, "mAlert");
|
final Object alertController = ReflectionHelpers.getField(mRealAlertDialog, "mAlert");
|
||||||
return ReflectionHelpers.getField(alertController, "mTitle");
|
return ReflectionHelpers.getField(alertController, "mTitle");
|
||||||
}
|
}
|
||||||
|
|
||||||
public View getView() {
|
public View getView() {
|
||||||
final Object alertController = ReflectionHelpers.getField(realAlertDialog, "mAlert");
|
final Object alertController = ReflectionHelpers.getField(mRealAlertDialog, "mAlert");
|
||||||
return ReflectionHelpers.getField(alertController, "mView");
|
return ReflectionHelpers.getField(alertController, "mView");
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static AlertDialog getLatestAlertDialog() {
|
public static AlertDialog getLatestAlertDialog() {
|
||||||
return latestSupportAlertDialog == null ? null : latestSupportAlertDialog.realAlertDialog;
|
return sLatestSupportAlertDialog == null
|
||||||
|
? null : sLatestSupportAlertDialog.mRealAlertDialog;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Resetter
|
@Resetter
|
||||||
public static void reset() {
|
public static void reset() {
|
||||||
latestSupportAlertDialog = null;
|
sLatestSupportAlertDialog = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ShadowAlertDialogCompat shadowOf(AlertDialog alertDialog) {
|
public static ShadowAlertDialogCompat shadowOf(AlertDialog alertDialog) {
|
||||||
@@ -78,6 +79,6 @@ public class ShadowAlertDialogCompat extends ShadowDialog {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void clickOnItem(int index) {
|
public void clickOnItem(int index) {
|
||||||
Shadows.shadowOf(realAlertDialog.getListView()).performItemClick(index);
|
Shadows.shadowOf(mRealAlertDialog.getListView()).performItemClick(index);
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (C) 2018 The Android Open Source Project
|
* Copyright (C) 2023 The Android Open Source Project
|
||||||
*
|
*
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
* you may not use this file except in compliance with the License.
|
* you may not use this file except in compliance with the License.
|
||||||
@@ -16,16 +16,23 @@
|
|||||||
|
|
||||||
package com.android.settings.testutils.shadow;
|
package com.android.settings.testutils.shadow;
|
||||||
|
|
||||||
import com.android.settingslib.wifi.AccessPoint;
|
import com.android.settings.datausage.DataSaverBackend;
|
||||||
|
|
||||||
import org.robolectric.annotation.Implementation;
|
import org.robolectric.annotation.Implementation;
|
||||||
import org.robolectric.annotation.Implements;
|
import org.robolectric.annotation.Implements;
|
||||||
|
|
||||||
@Implements(AccessPoint.class)
|
@Implements(DataSaverBackend.class)
|
||||||
public class ShadowAccessPoint {
|
public class ShadowDataSaverBackend {
|
||||||
|
|
||||||
|
private static boolean sIsEnabled = true;
|
||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
protected String getSavedNetworkSummary() {
|
protected boolean isDataSaverEnabled() {
|
||||||
return "saved";
|
return sIsEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Implementation
|
||||||
|
protected void setDataSaverEnabled(boolean enabled) {
|
||||||
|
sIsEnabled = enabled;
|
||||||
}
|
}
|
||||||
}
|
}
|
@@ -114,8 +114,8 @@ public class ShadowLockPatternUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
protected byte[] getPasswordHistoryHashFactor(LockscreenCredential currentPassword,
|
protected byte[] getPasswordHistoryHashFactor(
|
||||||
int userId) {
|
LockscreenCredential currentPassword, int userId) {
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -130,8 +130,8 @@ public class ShadowLockPatternUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
public @DevicePolicyManager.PasswordComplexity int getRequestedPasswordComplexity(int userId,
|
@DevicePolicyManager.PasswordComplexity
|
||||||
boolean deviceWideOnly) {
|
public int getRequestedPasswordComplexity(int userId, boolean deviceWideOnly) {
|
||||||
int complexity = sUserToComplexityMap.getOrDefault(userId,
|
int complexity = sUserToComplexityMap.getOrDefault(userId,
|
||||||
DevicePolicyManager.PASSWORD_COMPLEXITY_NONE);
|
DevicePolicyManager.PASSWORD_COMPLEXITY_NONE);
|
||||||
if (!deviceWideOnly) {
|
if (!deviceWideOnly) {
|
||||||
@@ -178,14 +178,16 @@ public class ShadowLockPatternUtils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
public boolean setLockCredential(@NonNull LockscreenCredential newCredential,
|
public boolean setLockCredential(
|
||||||
|
@NonNull LockscreenCredential newCredential,
|
||||||
@NonNull LockscreenCredential savedCredential, int userHandle) {
|
@NonNull LockscreenCredential savedCredential, int userHandle) {
|
||||||
setIsSecure(userHandle, true);
|
setIsSecure(userHandle, true);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
public boolean checkCredential(@NonNull LockscreenCredential credential, int userId,
|
public boolean checkCredential(
|
||||||
|
@NonNull LockscreenCredential credential, int userId,
|
||||||
@Nullable LockPatternUtils.CheckCredentialProgressCallback progressCallback)
|
@Nullable LockPatternUtils.CheckCredentialProgressCallback progressCallback)
|
||||||
throws LockPatternUtils.RequestThrottledException {
|
throws LockPatternUtils.RequestThrottledException {
|
||||||
return true;
|
return true;
|
@@ -52,7 +52,7 @@ public class ShadowUserManager extends org.robolectric.shadows.ShadowUserManager
|
|||||||
private final Set<Integer> mManagedProfiles = new HashSet<>();
|
private final Set<Integer> mManagedProfiles = new HashSet<>();
|
||||||
private final Set<String> mEnabledTypes = new HashSet<>();
|
private final Set<String> mEnabledTypes = new HashSet<>();
|
||||||
private boolean mIsQuietModeEnabled = false;
|
private boolean mIsQuietModeEnabled = false;
|
||||||
private int[] profileIdsForUser = new int[0];
|
private int[] mProfileIdsForUser = new int[0];
|
||||||
private boolean mUserSwitchEnabled;
|
private boolean mUserSwitchEnabled;
|
||||||
private Bundle mDefaultGuestUserRestriction = new Bundle();
|
private Bundle mDefaultGuestUserRestriction = new Bundle();
|
||||||
private boolean mIsGuestUser = false;
|
private boolean mIsGuestUser = false;
|
||||||
@@ -154,11 +154,11 @@ public class ShadowUserManager extends org.robolectric.shadows.ShadowUserManager
|
|||||||
|
|
||||||
@Implementation
|
@Implementation
|
||||||
protected int[] getProfileIdsWithDisabled(@UserIdInt int userId) {
|
protected int[] getProfileIdsWithDisabled(@UserIdInt int userId) {
|
||||||
return profileIdsForUser;
|
return mProfileIdsForUser;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setProfileIdsWithDisabled(int[] profileIds) {
|
public void setProfileIdsWithDisabled(int[] profileIds) {
|
||||||
profileIdsForUser = profileIds;
|
mProfileIdsForUser = profileIds;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Implementation
|
@Implementation
|
Reference in New Issue
Block a user