Snap for 10086753 from 2f970a1a05 to udc-release

Change-Id: I275617bfd395f10887efd7f582b81cedd003da77
This commit is contained in:
Android Build Coastguard Worker
2023-05-08 23:39:54 +00:00
10 changed files with 117 additions and 98 deletions

View File

@@ -1,69 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
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.
-->
<com.google.android.setupdesign.GlifLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:icon="@drawable/ic_scan_32dp"
app:sudDescriptionText="@string/wifi_dpp_scan_qr_code_join_unknown_network">
<LinearLayout
style="@style/SudContentFrame"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="@dimen/qrcode_preview_size"
android:layout_height="@dimen/qrcode_preview_size"
android:clipChildren="true">
<TextureView
android:id="@+id/preview_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
<com.android.settingslib.qrcode.QrDecorateView
android:id="@+id/decorate_view"
android:layout_width="wrap_content"
android:layout_height="match_parent"/>
</FrameLayout>
<TextView
android:id="@+id/error_message"
style="@style/TextAppearance.ErrorText"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:layout_marginStart="?attr/sudMarginStart"
android:layout_marginEnd="?attr/sudMarginEnd"
android:textAlignment="center"
android:visibility="invisible"/>
</LinearLayout>
</LinearLayout>
</com.google.android.setupdesign.GlifLayout>

View File

@@ -36,19 +36,31 @@
android:gravity="center"
android:orientation="vertical">
<FrameLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clipChildren="true">
<TextureView
android:id="@+id/preview_view"
android:layout_width="match_parent"
android:layout_height="@dimen/qrcode_preview_size"/>
<com.android.settingslib.qrcode.QrDecorateView
android:id="@+id/decorate_view"
android:layout_width="match_parent"
android:layout_height="@dimen/qrcode_preview_size"/>
</FrameLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:maxWidth="@dimen/qrcode_preview_size"
android:maxHeight="@dimen/qrcode_preview_size">
<FrameLayout
android:layout_width="0dp"
android:layout_height="0dp"
app:layout_constraintDimensionRatio="1:1"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:clipChildren="true">
<TextureView
android:id="@+id/preview_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.android.settingslib.qrcode.QrDecorateView
android:id="@+id/decorate_view"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
</FrameLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:id="@+id/error_message"

View File

@@ -5175,7 +5175,7 @@
<!-- Title for the battery limited temporarily tip [CHAR LIMIT=NONE] -->
<string name="battery_tip_limited_temporarily_title">Charging optimized to protect your battery</string>
<!-- Summary for the battery limited temporarily tip [CHAR LIMIT=NONE] -->
<string name="battery_tip_limited_temporarily_summary">To help extend your batter\'s lifespan, charging is optimized</string>
<string name="battery_tip_limited_temporarily_summary">To help extend your battery\'s lifespan, charging is optimized</string>
<!-- Title for the battery dock defender future bypass tip [CHAR LIMIT=NONE] -->
<string name="battery_tip_dock_defender_future_bypass_title">Charging optimized to protect your battery</string>
<!-- Summary for the battery dock defender future bypass tip [CHAR LIMIT=NONE] -->

View File

@@ -27,7 +27,8 @@
<com.android.settingslib.widget.IllustrationPreference
android:key="flash_notifications_illustration"
settings:searchable="false"
settings:lottie_rawRes="@drawable/flash_notifications_illustration" />
settings:lottie_rawRes="@drawable/flash_notifications_illustration"
settings:controller="com.android.settings.accessibility.FlashNotificationIllustrationPreferenceController"/>
<SwitchPreference
android:key="camera_flash_notification_preference"

View File

@@ -22,9 +22,8 @@ import android.net.Uri;
import android.provider.Settings;
import android.util.FeatureFlagUtils;
import androidx.window.embedding.SplitController;
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
import com.android.settings.core.instrumentation.ElapsedTimeUtils;
import com.android.settings.homepage.SettingsHomepageActivity;
import com.android.settings.spa.SettingsSpaEnvironment;
@@ -53,7 +52,7 @@ public class SettingsApplication extends Application {
setSpaEnvironment();
if (FeatureFlagUtils.isEnabled(this, FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN)
&& SplitController.getInstance(this).isSplitSupported()) {
&& ActivityEmbeddingUtils.isSettingsSplitEnabled(this)) {
if (WizardManagerHelper.isUserSetupComplete(this)) {
new ActivityEmbeddingRulesController(this).initRules();
} else {

View File

@@ -37,9 +37,9 @@ import android.os.UserManager;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.window.embedding.SplitController;
import com.android.settings.Settings.CreateShortcutActivity;
import com.android.settings.activityembedding.ActivityEmbeddingUtils;
import com.android.settings.homepage.DeepLinkHomepageActivity;
import com.android.settings.search.SearchStateReceiver;
import com.android.settingslib.utils.ThreadUtils;
@@ -166,7 +166,7 @@ public class SettingsInitialize extends BroadcastReceiver {
DeepLinkHomepageActivity.class);
final ComponentName searchStateReceiver = new ComponentName(context,
SearchStateReceiver.class);
final int enableState = SplitController.getInstance(context).isSplitSupported()
final int enableState = ActivityEmbeddingUtils.isSettingsSplitEnabled(context)
? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
pm.setComponentEnabledSetting(deepLinkHome, enableState, PackageManager.DONT_KILL_APP);

View File

@@ -0,0 +1,46 @@
/*
* 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.accessibility;
import android.content.Context;
import android.os.SystemProperties;
import android.util.ArraySet;
import com.android.settings.core.BasePreferenceController;
import java.util.Collections;
import java.util.Set;
/** Preference controller for illustration in flash notifications page. */
public class FlashNotificationIllustrationPreferenceController extends BasePreferenceController {
public FlashNotificationIllustrationPreferenceController(Context context,
String preferenceKey) {
super(context, preferenceKey);
}
@Override
public int getAvailabilityStatus() {
// TODO(b/280748155): Update tablet illustration when it's available. Hide it for now.
String characteristics = SystemProperties.get("ro.build.characteristics");
String[] characteristicsSplit = characteristics.split(",");
Set<String> productCharacteristics = new ArraySet<>(characteristicsSplit.length);
Collections.addAll(productCharacteristics, characteristicsSplit);
final boolean isTablet = productCharacteristics.contains("tablet");
return isTablet ? UNSUPPORTED_ON_DEVICE : AVAILABLE;
}
}

View File

@@ -18,6 +18,7 @@ package com.android.settings.activityembedding;
import android.app.Activity;
import android.content.Context;
import android.os.SystemProperties;
import android.util.DisplayMetrics;
import android.util.FeatureFlagUtils;
import android.util.Log;
@@ -39,6 +40,21 @@ public class ActivityEmbeddingUtils {
private static final int MIN_SMALLEST_SCREEN_SPLIT_WIDTH_DP = 600;
// The minimum width of the activity to show the regular homepage layout.
private static final float MIN_REGULAR_HOMEPAGE_LAYOUT_WIDTH_DP = 380f;
/**
* Indicates whether to enable large screen optimization if the device supports
* the Activity Embedding split feature.
* <p>
* Note that the large screen optimization won't be enabled if the device doesn't support the
* Activity Embedding feature regardless of this property value.
*
* @see androidx.window.embedding.SplitController#getSplitSupportStatus
* @see androidx.window.embedding.SplitController.SplitSupportStatus#SPLIT_AVAILABLE
* @see androidx.window.embedding.SplitController.SplitSupportStatus#SPLIT_UNAVAILABLE
*/
private static final boolean SHOULD_ENABLE_LARGE_SCREEN_OPTIMIZATION =
SystemProperties.getBoolean("persist.settings.large_screen_opt.enabled", true);
private static final String TAG = "ActivityEmbeddingUtils";
/** Get the smallest width dp of the window when the split should be used. */
@@ -62,18 +78,35 @@ public class ActivityEmbeddingUtils {
return context.getResources().getFloat(R.dimen.config_activity_embed_split_ratio);
}
/** Whether to support embedding activity feature. */
/**
* Returns {@code true} to indicate that Settings app support the Activity Embedding feature on
* this device. Returns {@code false}, otherwise.
*/
public static boolean isSettingsSplitEnabled(Context context) {
return SHOULD_ENABLE_LARGE_SCREEN_OPTIMIZATION
&& SplitController.getInstance(context).getSplitSupportStatus()
== SplitController.SplitSupportStatus.SPLIT_AVAILABLE;
}
/**
* Checks whether to support embedding activity feature with following conditions:
* <ul>
* <li>Whether {@link #isSettingsSplitEnabled(Context)}</li>
* <li>Whether {@link FeatureFlagUtils#SETTINGS_SUPPORT_LARGE_SCREEN} is enabled</li>
* <li>Whether User setup is completed</li>
* </ul>
*/
public static boolean isEmbeddingActivityEnabled(Context context) {
boolean isFlagEnabled = FeatureFlagUtils.isEnabled(context,
FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN);
boolean isSplitSupported = SplitController.getInstance(context).isSplitSupported();
boolean isSettingsSplitSupported = isSettingsSplitEnabled(context);
boolean isUserSetupComplete = WizardManagerHelper.isUserSetupComplete(context);
Log.d(TAG, "isFlagEnabled = " + isFlagEnabled);
Log.d(TAG, "isSplitSupported = " + isSplitSupported);
Log.d(TAG, "isSettingsSplitSupported = " + isSettingsSplitSupported);
Log.d(TAG, "isUserSetupComplete = " + isUserSetupComplete);
return isFlagEnabled && isSplitSupported && isUserSetupComplete;
return isFlagEnabled && isSettingsSplitSupported && isUserSetupComplete;
}
/** Whether to show the regular or simplified homepage layout. */

View File

@@ -58,7 +58,6 @@ import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.window.embedding.ActivityEmbeddingController;
import androidx.window.embedding.SplitController;
import androidx.window.embedding.SplitRule;
import com.android.settings.R;
@@ -429,7 +428,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
private boolean shouldLaunchDeepLinkIntentToRight() {
if (!FeatureFlagUtils.isEnabled(this, FeatureFlagUtils.SETTINGS_SUPPORT_LARGE_SCREEN)
|| !SplitController.getInstance(this).isSplitSupported()) {
|| !ActivityEmbeddingUtils.isSettingsSplitEnabled(this)) {
return false;
}

View File

@@ -39,7 +39,6 @@ import android.telephony.SubscriptionManager;
import android.telephony.TelephonyManager;
import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.Mock;
@@ -197,11 +196,10 @@ public class ImeiInfoDialogControllerTest {
}
@Test
@Ignore
public void populateImeiInfo_emptyImei_shouldSetMeid_imeiSetToEmptyString() {
doReturn(true).when(mController).isCdmaLteEnabled();
when(mTelephonyManager.getPhoneType()).thenReturn(TelephonyManager.PHONE_TYPE_CDMA);
when(mTelephonyManager.getImei(anyInt())).thenReturn(null);
when(mTelephonyManager.getImei(anyInt())).thenReturn("");
mController.populateImeiInfo();