Snap for 7952937 from 1026e410f4 to sc-v2-release

Change-Id: I653eee59d0ec1f2d8c150811e63b5a88b9b94544
This commit is contained in:
Android Build Coastguard Worker
2021-11-30 00:08:40 +00:00
9 changed files with 98 additions and 39 deletions

View File

@@ -1882,6 +1882,7 @@
<activity
android:name=".accessibility.AccessibilityScreenSizeForSetupWizardActivity"
android:theme="@android:style/Theme.DeviceDefault.Settings"
android:exported="false"/>
<activity

View File

@@ -7452,7 +7452,7 @@
<!-- Button label to disconnect from a VPN profile. [CHAR LIMIT=40] -->
<string name="vpn_disconnect">Disconnect</string>
<!-- Field label to show the version number for a VPN app. [CHAR LIMIT=40] -->
<string name="vpn_version">Version <xliff:g id="version" example="3.3.0">%s</xliff:g></string>
<string name="vpn_version">Version</string>
<!-- Button label to forget a VPN profile [CHAR LIMIT=40] -->
<string name="vpn_forget_long">Forget VPN</string>
<!-- Dialog message title to set another VPN app to be always-on [CHAR LIMIT=40] -->

View File

@@ -237,6 +237,16 @@
<item name="android:textAppearance">@android:style/TextAppearance.DeviceDefault.Small</item>
</style>
<style name="vpn_app_management_version_title">
<item name="android:textAppearance">?android:attr/textAppearanceListItem</item>
<item name="android:textColor">?android:attr/textColorPrimary</item>
</style>
<style name="vpn_app_management_version_summary">
<item name="android:textAppearance">?android:attr/textAppearanceListItemSecondary</item>
<item name="android:textColor">?android:attr/textColorSecondary</item>
</style>
<style name="screen_size_imageview_style">
<item name="android:layout_width">48dp</item>
<item name="android:layout_height">48dp</item>

View File

@@ -15,14 +15,24 @@
-->
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:settings="http://schemas.android.com/apk/res-auto">
xmlns:settings="http://schemas.android.com/apk/res-auto"
orderingFromXml="false"
>
<!-- To limit the size (in height) of version Preference displayed here,
maximum height of TextView need to be set programmingly.
Therefore, this Preference got removed from here and will be added
dynamically through source code.
<Preference
android:order="0"
android:key="version"
android:textColor="?android:attr/textColorSecondary"
android:selectable="false"/>
-->
<com.android.settingslib.RestrictedSwitchPreference
android:order="10"
android:key="always_on_vpn"
android:title="@string/vpn_menu_lockdown"
android:defaultValue="false"
@@ -32,6 +42,7 @@
settings:restrictedSwitchSummary="@string/disabled_by_admin_summary_text" />
<com.android.settingslib.RestrictedSwitchPreference
android:order="20"
android:key="lockdown_vpn"
android:title="@string/vpn_require_connection"
android:defaultValue="false"
@@ -41,6 +52,7 @@
settings:restrictedSwitchSummary="@string/disabled_by_admin_summary_text" />
<com.android.settingslib.RestrictedPreference
android:order="30"
android:key="forget_vpn"
android:title="@string/vpn_forget_long"
android:icon="@drawable/ic_delete"

View File

@@ -77,8 +77,8 @@ public class ActivityEmbeddingRulesController {
ComponentName primaryComponent,
ComponentName secondaryComponent,
String secondaryIntentAction,
boolean finishPrimaryWithSecondary,
boolean finishSecondaryWithPrimary,
int finishPrimaryWithSecondary,
int finishSecondaryWithPrimary,
boolean clearTop) {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) {
return;
@@ -88,8 +88,8 @@ public class ActivityEmbeddingRulesController {
secondaryIntentAction));
SplitController.getInstance().registerRule(new SplitPairRule(filters,
finishPrimaryWithSecondary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
finishSecondaryWithPrimary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
finishPrimaryWithSecondary,
finishSecondaryWithPrimary,
clearTop,
ActivityEmbeddingUtils.getMinCurrentScreenSplitWidthPx(context),
ActivityEmbeddingUtils.getMinSmallestScreenSplitWidthPx(context),
@@ -117,17 +117,8 @@ public class ActivityEmbeddingRulesController {
getComponentName(context, Settings.class),
secondaryComponent,
secondaryIntentAction,
finishPrimaryWithSecondary,
finishSecondaryWithPrimary,
clearTop);
registerTwoPanePairRule(
context,
new ComponentName(context, DeepLinkHomepageActivity.class),
secondaryComponent,
secondaryIntentAction,
finishPrimaryWithSecondary,
finishSecondaryWithPrimary,
finishPrimaryWithSecondary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
finishSecondaryWithPrimary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
clearTop);
registerTwoPanePairRule(
@@ -135,8 +126,19 @@ public class ActivityEmbeddingRulesController {
getComponentName(context, SettingsHomepageActivity.class),
secondaryComponent,
secondaryIntentAction,
finishPrimaryWithSecondary,
finishSecondaryWithPrimary,
finishPrimaryWithSecondary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
finishSecondaryWithPrimary ? SplitRule.FINISH_ADJACENT : SplitRule.FINISH_NEVER,
clearTop);
// We should finish HomePageActivity altogether even if it shows in single pane for all deep
// link cases.
registerTwoPanePairRule(
context,
new ComponentName(context, DeepLinkHomepageActivity.class),
secondaryComponent,
secondaryIntentAction,
finishPrimaryWithSecondary ? SplitRule.FINISH_ALWAYS : SplitRule.FINISH_NEVER,
finishSecondaryWithPrimary ? SplitRule.FINISH_ALWAYS : SplitRule.FINISH_NEVER,
clearTop);
registerTwoPanePairRule(
@@ -144,8 +146,8 @@ public class ActivityEmbeddingRulesController {
getComponentName(context, SliceDeepLinkHomepageActivity.class),
secondaryComponent,
secondaryIntentAction,
finishPrimaryWithSecondary,
finishSecondaryWithPrimary,
finishPrimaryWithSecondary ? SplitRule.FINISH_ALWAYS : SplitRule.FINISH_NEVER,
finishSecondaryWithPrimary ? SplitRule.FINISH_ALWAYS : SplitRule.FINISH_NEVER,
clearTop);
}

View File

@@ -109,10 +109,6 @@ public class PreviewPagerAdapter extends PagerAdapter {
return (view == object);
}
FrameLayout[] getPreviewFrames() {
return mPreviewFrames;
}
boolean isAnimating() {
return mAnimationCounter > 0;
}

View File

@@ -264,12 +264,6 @@ public abstract class PreviewSeekBarPreferenceFragment extends SettingsPreferenc
@Override
public void onPageSelected(int position) {
mPreviewPager.sendAccessibilityEvent(AccessibilityEvent.TYPE_ANNOUNCEMENT);
// To avoid displaying previous page on the left side in SUW landscape mode for
// large size.
if (position > 0) {
mPreviewPagerAdapter.getPreviewFrames()[position - 1].setVisibility(View.INVISIBLE);
}
mPreviewPagerAdapter.getPreviewFrames()[position].setVisibility(View.VISIBLE);
}
};

View File

@@ -40,6 +40,7 @@ import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentActivity;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentTransaction;
import androidx.window.embedding.SplitRule;
import com.android.settings.R;
import com.android.settings.Settings;
@@ -338,15 +339,15 @@ public class SettingsHomepageActivity extends FragmentActivity implements
new ComponentName(getApplicationContext(), getClass()),
targetComponentName,
targetIntent.getAction(),
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
SplitRule.FINISH_ALWAYS,
SplitRule.FINISH_ALWAYS,
true /* clearTop*/);
ActivityEmbeddingRulesController.registerTwoPanePairRule(this,
new ComponentName(Settings.class.getPackageName(), Settings.class.getName()),
targetComponentName,
targetIntent.getAction(),
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
SplitRule.FINISH_ALWAYS,
SplitRule.FINISH_ALWAYS,
true /* clearTop*/);
startActivity(targetIntent);
}

View File

@@ -34,11 +34,13 @@ import android.os.UserHandle;
import android.os.UserManager;
import android.text.TextUtils;
import android.util.Log;
import android.widget.TextView;
import androidx.annotation.VisibleForTesting;
import androidx.appcompat.app.AlertDialog;
import androidx.fragment.app.DialogFragment;
import androidx.preference.Preference;
import androidx.preference.PreferenceViewHolder;
import com.android.internal.net.VpnConfig;
import com.android.internal.util.ArrayUtils;
@@ -77,7 +79,6 @@ public class AppManagementFragment extends SettingsPreferenceFragment
private String mVpnLabel;
// UI preference
private Preference mPreferenceVersion;
private RestrictedSwitchPreference mPreferenceAlwaysOn;
private RestrictedSwitchPreference mPreferenceLockdown;
private RestrictedPreference mPreferenceForget;
@@ -122,7 +123,6 @@ public class AppManagementFragment extends SettingsPreferenceFragment
mDevicePolicyManager = getContext().getSystemService(DevicePolicyManager.class);
mVpnManager = getContext().getSystemService(VpnManager.class);
mPreferenceVersion = findPreference(KEY_VERSION);
mPreferenceAlwaysOn = (RestrictedSwitchPreference) findPreference(KEY_ALWAYS_ON_VPN);
mPreferenceLockdown = (RestrictedSwitchPreference) findPreference(KEY_LOCKDOWN_VPN);
mPreferenceForget = (RestrictedPreference) findPreference(KEY_FORGET_VPN);
@@ -138,9 +138,52 @@ public class AppManagementFragment extends SettingsPreferenceFragment
boolean isInfoLoaded = loadInfo();
if (isInfoLoaded) {
mPreferenceVersion.setTitle(
getPrefContext().getString(R.string.vpn_version, mPackageInfo.versionName));
updateUI();
Preference version = getPreferenceScreen().findPreference(KEY_VERSION);
if (version != null) {
// Version field has been added.
return;
}
/**
* Create version field at runtime, and set max height on the display area.
*
* When long length of text given within version field, a large text area
* might be created and inconvenient to the user (User need to scroll
* for a long time in order to get to the Preferences after this field.)
*/
version = new Preference(getPrefContext()) {
@Override
public void onBindViewHolder(PreferenceViewHolder holder) {
super.onBindViewHolder(holder);
TextView titleView =
(TextView) holder.findViewById(android.R.id.title);
if (titleView != null) {
titleView.setTextAppearance(R.style.vpn_app_management_version_title);
}
TextView summaryView =
(TextView) holder.findViewById(android.R.id.summary);
if (summaryView != null) {
summaryView.setTextAppearance(R.style.vpn_app_management_version_summary);
// Set max height in summary area.
int versionMaxHeight = getListView().getHeight();
summaryView.setMaxHeight(versionMaxHeight);
summaryView.setVerticalScrollBarEnabled(false);
summaryView.setHorizontallyScrolling(false);
}
}
};
version.setOrder(0); // Set order to 0 in order to be placed
// in front of other Preference(s).
version.setKey(KEY_VERSION); // Set key to avoid from creating multi instance.
version.setTitle(R.string.vpn_version);
version.setSummary(mPackageInfo.versionName);
version.setSelectable(false);
getPreferenceScreen().addPreference(version);
} else {
finish();
}