Merge "Use config instead of local string for qr scanner" into tm-dev am: bbd351fe0e
Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/18186905 Change-Id: I8a3aa9aed524d51e7d2603fef890c55111ae2ab9 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -5662,6 +5662,9 @@
|
|||||||
<!-- Whether or not to enable the lock screen entry point for the QR code scanner. -->
|
<!-- Whether or not to enable the lock screen entry point for the QR code scanner. -->
|
||||||
<bool name="config_enableQrCodeScannerOnLockScreen">false</bool>
|
<bool name="config_enableQrCodeScannerOnLockScreen">false</bool>
|
||||||
|
|
||||||
|
<!-- Default component for QR code scanner -->
|
||||||
|
<string name="config_defaultQrCodeComponent"></string>
|
||||||
|
|
||||||
<!-- Whether Low Power Standby is supported and can be enabled. -->
|
<!-- Whether Low Power Standby is supported and can be enabled. -->
|
||||||
<bool name="config_lowPowerStandbySupported">false</bool>
|
<bool name="config_lowPowerStandbySupported">false</bool>
|
||||||
|
|
||||||
|
|||||||
@@ -4708,6 +4708,7 @@
|
|||||||
|
|
||||||
<java-symbol type="string" name="config_wearSysUiPackage"/>
|
<java-symbol type="string" name="config_wearSysUiPackage"/>
|
||||||
<java-symbol type="string" name="config_wearSysUiMainActivity"/>
|
<java-symbol type="string" name="config_wearSysUiMainActivity"/>
|
||||||
|
<java-symbol type="string" name="config_defaultQrCodeComponent"/>
|
||||||
|
|
||||||
<java-symbol type="dimen" name="secondary_rounded_corner_radius" />
|
<java-symbol type="dimen" name="secondary_rounded_corner_radius" />
|
||||||
<java-symbol type="dimen" name="secondary_rounded_corner_radius_top" />
|
<java-symbol type="dimen" name="secondary_rounded_corner_radius_top" />
|
||||||
|
|||||||
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
/**
|
|
||||||
* Copyright (c) 2009, The Android Open Source Project
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
-->
|
|
||||||
<resources>
|
|
||||||
<!-- Default for SystemUiDeviceConfigFlags.DEFAULT_QR_CODE_SCANNER.
|
|
||||||
To be set if the device wants to support out of the box QR code scanning experience -->
|
|
||||||
<string name="def_qr_code_component" translatable="false"></string>
|
|
||||||
</resources>
|
|
||||||
@@ -29,7 +29,6 @@ import android.provider.Settings;
|
|||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
|
|
||||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
||||||
import com.android.systemui.R;
|
|
||||||
import com.android.systemui.dagger.SysUISingleton;
|
import com.android.systemui.dagger.SysUISingleton;
|
||||||
import com.android.systemui.dagger.qualifiers.Background;
|
import com.android.systemui.dagger.qualifiers.Background;
|
||||||
import com.android.systemui.settings.UserTracker;
|
import com.android.systemui.settings.UserTracker;
|
||||||
@@ -119,7 +118,6 @@ public class QRCodeScannerController implements
|
|||||||
mSecureSettings = secureSettings;
|
mSecureSettings = secureSettings;
|
||||||
mDeviceConfigProxy = proxy;
|
mDeviceConfigProxy = proxy;
|
||||||
mUserTracker = userTracker;
|
mUserTracker = userTracker;
|
||||||
|
|
||||||
mConfigEnableLockScreenButton = mContext.getResources().getBoolean(
|
mConfigEnableLockScreenButton = mContext.getResources().getBoolean(
|
||||||
android.R.bool.config_enableQrCodeScannerOnLockScreen);
|
android.R.bool.config_enableQrCodeScannerOnLockScreen);
|
||||||
}
|
}
|
||||||
@@ -258,16 +256,20 @@ public class QRCodeScannerController implements
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getDefaultScannerActivity() {
|
||||||
|
return mContext.getResources().getString(
|
||||||
|
com.android.internal.R.string.config_defaultQrCodeComponent);
|
||||||
|
}
|
||||||
|
|
||||||
private void updateQRCodeScannerActivityDetails() {
|
private void updateQRCodeScannerActivityDetails() {
|
||||||
String qrCodeScannerActivity = mDeviceConfigProxy.getString(
|
String qrCodeScannerActivity = mDeviceConfigProxy.getString(
|
||||||
DeviceConfig.NAMESPACE_SYSTEMUI,
|
DeviceConfig.NAMESPACE_SYSTEMUI,
|
||||||
SystemUiDeviceConfigFlags.DEFAULT_QR_CODE_SCANNER, "");
|
SystemUiDeviceConfigFlags.DEFAULT_QR_CODE_SCANNER, "");
|
||||||
|
|
||||||
// "" means either the flags is not available or is set to "", and in both the cases we
|
// "" means either the flags is not available or is set to "", and in both the cases we
|
||||||
// want to use R.string.def_qr_code_component
|
// want to use R.string.config_defaultQrCodeComponent
|
||||||
if (Objects.equals(qrCodeScannerActivity, "")) {
|
if (Objects.equals(qrCodeScannerActivity, "")) {
|
||||||
qrCodeScannerActivity =
|
qrCodeScannerActivity = getDefaultScannerActivity();
|
||||||
mContext.getResources().getString(R.string.def_qr_code_component);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
String prevQrCodeScannerActivity = mQRCodeScannerActivity;
|
String prevQrCodeScannerActivity = mQRCodeScannerActivity;
|
||||||
|
|||||||
@@ -24,7 +24,6 @@ import static com.android.systemui.qrcodescanner.controller.QRCodeScannerControl
|
|||||||
import static com.google.common.truth.Truth.assertThat;
|
import static com.google.common.truth.Truth.assertThat;
|
||||||
|
|
||||||
import static org.mockito.ArgumentMatchers.any;
|
import static org.mockito.ArgumentMatchers.any;
|
||||||
import static org.mockito.ArgumentMatchers.anyInt;
|
|
||||||
import static org.mockito.Mockito.times;
|
import static org.mockito.Mockito.times;
|
||||||
import static org.mockito.Mockito.verify;
|
import static org.mockito.Mockito.verify;
|
||||||
import static org.mockito.Mockito.when;
|
import static org.mockito.Mockito.when;
|
||||||
@@ -32,6 +31,7 @@ import static org.mockito.Mockito.when;
|
|||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.pm.PackageManager;
|
import android.content.pm.PackageManager;
|
||||||
import android.content.pm.ResolveInfo;
|
import android.content.pm.ResolveInfo;
|
||||||
|
import android.content.res.Resources;
|
||||||
import android.os.UserHandle;
|
import android.os.UserHandle;
|
||||||
import android.provider.DeviceConfig;
|
import android.provider.DeviceConfig;
|
||||||
import android.provider.Settings;
|
import android.provider.Settings;
|
||||||
@@ -41,7 +41,6 @@ import android.testing.TestableLooper;
|
|||||||
import androidx.test.filters.SmallTest;
|
import androidx.test.filters.SmallTest;
|
||||||
|
|
||||||
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
import com.android.internal.config.sysui.SystemUiDeviceConfigFlags;
|
||||||
import com.android.systemui.R;
|
|
||||||
import com.android.systemui.SysuiTestCase;
|
import com.android.systemui.SysuiTestCase;
|
||||||
import com.android.systemui.settings.UserTracker;
|
import com.android.systemui.settings.UserTracker;
|
||||||
import com.android.systemui.util.DeviceConfigProxyFake;
|
import com.android.systemui.util.DeviceConfigProxyFake;
|
||||||
@@ -90,8 +89,9 @@ public class QRCodeScannerControllerTest extends SysuiTestCase {
|
|||||||
when(mPackageManager.queryIntentActivities(any(Intent.class),
|
when(mPackageManager.queryIntentActivities(any(Intent.class),
|
||||||
any(Integer.class))).thenReturn(resolveInfoList);
|
any(Integer.class))).thenReturn(resolveInfoList);
|
||||||
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)).thenReturn(true);
|
when(mPackageManager.hasSystemFeature(PackageManager.FEATURE_CAMERA)).thenReturn(true);
|
||||||
mContext.getOrCreateTestableResources().addOverride(R.string.def_qr_code_component,
|
mContext.getOrCreateTestableResources().addOverride(
|
||||||
defaultActivity);
|
com.android.internal.R.string.config_defaultQrCodeComponent, defaultActivity);
|
||||||
|
|
||||||
mContext.getOrCreateTestableResources().addOverride(
|
mContext.getOrCreateTestableResources().addOverride(
|
||||||
android.R.bool.config_enableQrCodeScannerOnLockScreen, enableOnLockScreen);
|
android.R.bool.config_enableQrCodeScannerOnLockScreen, enableOnLockScreen);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user