Snap for 7890423 from 9f66f6677a to tm-release

Change-Id: I34b453bbf99e04a7763a296a57d13c70b301d648
This commit is contained in:
Android Build Coastguard Worker
2021-11-06 03:08:52 +00:00
17 changed files with 142 additions and 47 deletions

View File

@@ -1196,6 +1196,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.security.LockscreenDashboardFragment" /> android:value="com.android.settings.security.LockscreenDashboardFragment" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_display"/>
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
</activity> </activity>
@@ -1222,6 +1224,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.deviceinfo.legal.ModuleLicensesDashboard" /> android:value="com.android.settings.deviceinfo.legal.ModuleLicensesDashboard" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_about_device"/>
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
</activity> </activity>
@@ -1242,6 +1246,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.applications.manageapplications.ManageApplications" /> android:value="com.android.settings.applications.manageapplications.ManageApplications" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_apps"/>
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
</activity> </activity>
@@ -1265,6 +1271,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.applications.managedomainurls.ManageDomainUrls" /> android:value="com.android.settings.applications.managedomainurls.ManageDomainUrls" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_apps"/>
</activity> </activity>
<activity android:name="Settings$AppMemoryUsageActivity" <activity android:name="Settings$AppMemoryUsageActivity"
@@ -1277,6 +1285,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.applications.ProcessStatsUi" /> android:value="com.android.settings.applications.ProcessStatsUi" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_apps"/>
</activity> </activity>
<activity <activity
@@ -1289,6 +1299,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.applications.manageapplications.ManageApplications" /> android:value="com.android.settings.applications.manageapplications.ManageApplications" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_apps"/>
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
</activity> </activity>
@@ -1395,6 +1407,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.applications.manageapplications.ManageApplications" /> android:value="com.android.settings.applications.manageapplications.ManageApplications" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_apps"/>
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
</activity> </activity>
@@ -1416,6 +1430,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.applications.manageapplications.ManageApplications" /> android:value="com.android.settings.applications.manageapplications.ManageApplications" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_apps"/>
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
</activity> </activity>
@@ -2251,6 +2267,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.network.apn.ApnEditor" /> android:value="com.android.settings.network.apn.ApnEditor" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_network"/>
</activity> </activity>
<activity <activity
@@ -2279,6 +2297,8 @@
android:value="com.android.settings.development.DevelopmentSettingsDashboardFragment" /> android:value="com.android.settings.development.DevelopmentSettingsDashboardFragment" />
<meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED" <meta-data android:name="com.android.settings.PRIMARY_PROFILE_CONTROLLED"
android:value="true" /> android:value="true" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_system"/>
</activity> </activity>
<!-- The opposite of DevelopmentSettingsActivity, it's no-op and only enabled when the real <!-- The opposite of DevelopmentSettingsActivity, it's no-op and only enabled when the real
@@ -2313,6 +2333,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.print.PrintSettingsFragment" /> android:value="com.android.settings.print.PrintSettingsFragment" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_connected_devices"/>
</activity> </activity>
<activity android:name="Settings$PrintJobSettingsActivity" <activity android:name="Settings$PrintJobSettingsActivity"
@@ -2325,6 +2347,8 @@
</intent-filter> </intent-filter>
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.print.PrintJobSettingsFragment" /> android:value="com.android.settings.print.PrintJobSettingsFragment" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_connected_devices"/>
</activity> </activity>
<activity android:name=".development.AppPicker" <activity android:name=".development.AppPicker"
@@ -2345,7 +2369,10 @@
android:label="@string/accessor_info_title" /> android:label="@string/accessor_info_title" />
<activity android:name="Settings$WebViewAppPickerActivity" <activity android:name="Settings$WebViewAppPickerActivity"
android:label="@string/select_webview_provider_dialog_title" /> android:label="@string/select_webview_provider_dialog_title">
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_system"/>
</activity>
<activity android:name="Settings$BugReportHandlerPickerActivity" <activity android:name="Settings$BugReportHandlerPickerActivity"
android:label="@string/bug_report_handler_title" android:label="@string/bug_report_handler_title"
@@ -2359,6 +2386,8 @@
android:value="true" /> android:value="true" />
<meta-data android:name="com.android.settings.FRAGMENT_CLASS" <meta-data android:name="com.android.settings.FRAGMENT_CLASS"
android:value="com.android.settings.bugreporthandler.BugReportHandlerPicker" /> android:value="com.android.settings.bugreporthandler.BugReportHandlerPicker" />
<meta-data android:name="com.android.settings.HIGHLIGHT_MENU_KEY"
android:value="@string/menu_key_system"/>
</activity> </activity>
<activity android:name=".bluetooth.BluetoothPairingDialog" <activity android:name=".bluetooth.BluetoothPairingDialog"

View File

@@ -51,6 +51,7 @@
style="@style/LockPatternContainerStyle" style="@style/LockPatternContainerStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:minHeight="@dimen/choose_lockscreen_min_height"
android:layout_weight="1"> android:layout_weight="1">
<com.android.internal.widget.LockPatternView <com.android.internal.widget.LockPatternView

View File

@@ -67,6 +67,7 @@
style="@style/LockPatternContainerStyle" style="@style/LockPatternContainerStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:minHeight="@dimen/choose_lockscreen_min_height"
android:layout_weight="1"> android:layout_weight="1">
<com.android.internal.widget.LockPatternView <com.android.internal.widget.LockPatternView

View File

@@ -39,6 +39,7 @@
style="@style/LockPatternContainerStyle" style="@style/LockPatternContainerStyle"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
android:minHeight="@dimen/choose_lockscreen_min_height"
android:layout_weight="1"> android:layout_weight="1">
<com.android.internal.widget.LockPatternView <com.android.internal.widget.LockPatternView

View File

@@ -313,6 +313,9 @@
The unit is sp as it is related to the text size of password requirement item. --> The unit is sp as it is related to the text size of password requirement item. -->
<dimen name="visible_vertical_space_below_password">20sp</dimen> <dimen name="visible_vertical_space_below_password">20sp</dimen>
<!-- Minimum height for setting a lock pattern -->
<dimen name="choose_lockscreen_min_height">200dp</dimen>
<!-- Select dialog --> <!-- Select dialog -->
<dimen name="select_dialog_padding_start">20dp</dimen> <dimen name="select_dialog_padding_start">20dp</dimen>
<dimen name="select_dialog_item_margin_start">12dp</dimen> <dimen name="select_dialog_item_margin_start">12dp</dimen>

View File

@@ -451,6 +451,11 @@ public class SettingsActivity extends SettingsBaseActivity
return false; return false;
} }
if (intent.getBooleanExtra(SettingsHomepageActivity.EXTRA_IS_FROM_SETTINGS_HOMEPAGE,
/* defaultValue */ false)) {
return false;
}
if (TextUtils.equals(intent.getAction(), Intent.ACTION_CREATE_SHORTCUT)) { if (TextUtils.equals(intent.getAction(), Intent.ACTION_CREATE_SHORTCUT)) {
// Returns false to show full screen for Intent.ACTION_CREATE_SHORTCUT because // Returns false to show full screen for Intent.ACTION_CREATE_SHORTCUT because
// - Launcher startActivityForResult for Intent.ACTION_CREATE_SHORTCUT and activity // - Launcher startActivityForResult for Intent.ACTION_CREATE_SHORTCUT and activity

View File

@@ -73,6 +73,9 @@ public class ActivityEmbeddingRulesController {
boolean finishPrimaryWithSecondary, boolean finishPrimaryWithSecondary,
boolean finishSecondaryWithPrimary, boolean finishSecondaryWithPrimary,
boolean clearTop) { boolean clearTop) {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) {
return;
}
final Set<SplitPairFilter> filters = new HashSet<>(); final Set<SplitPairFilter> filters = new HashSet<>();
filters.add(new SplitPairFilter(primaryComponent, secondaryComponent, filters.add(new SplitPairFilter(primaryComponent, secondaryComponent,
secondaryIntentAction)); secondaryIntentAction));
@@ -87,18 +90,55 @@ public class ActivityEmbeddingRulesController {
LayoutDirection.LOCALE)); LayoutDirection.LOCALE));
} }
/**
* Register a new SplitPairRule for Settings home. Because homepage is able to be opened by
* {@link Settings} or {@link SettingsHomepageActivity}, we register split rule twice for
* two cases.
*/
public static void registerTwoPanePairRuleForSettingsHome(Context context,
ComponentName secondaryComponent,
String secondaryIntentAction,
boolean clearTop) {
registerTwoPanePairRule(
context,
getComponentName(context, Settings.class),
secondaryComponent,
secondaryIntentAction,
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
clearTop);
registerTwoPanePairRule(
context,
new ComponentName(Utils.SETTINGS_PACKAGE_NAME,
SettingsHomepageActivity.ALIAS_DEEP_LINK),
secondaryComponent,
secondaryIntentAction,
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
clearTop);
registerTwoPanePairRule(
context,
getComponentName(context, SettingsHomepageActivity.class),
secondaryComponent,
secondaryIntentAction,
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
clearTop);
}
/** Register a SplitPairRule for SubSettings if the device supports 2-pane. */ /** Register a SplitPairRule for SubSettings if the device supports 2-pane. */
public static void registerSubSettingsPairRuleIfNeeded(Context context, boolean clearTop) { public static void registerSubSettingsPairRule(Context context, boolean clearTop) {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) { if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(context)) {
return; return;
} }
registerTwoPanePairRule(context, registerTwoPanePairRuleForSettingsHome(
getComponentName(context, Settings.class), context,
getComponentName(context, SubSettings.class), getComponentName(context, SubSettings.class),
null /* secondaryIntentAction */, null /* secondaryIntentAction */,
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
clearTop); clearTop);
} }
@@ -140,7 +180,7 @@ public class ActivityEmbeddingRulesController {
@NonNull @NonNull
private static ComponentName getComponentName(Context context, private static ComponentName getComponentName(Context context,
Class<? extends Activity> activityClass) { Class<? extends Activity> activityClass) {
return new ComponentName(context.getPackageName(), activityClass.getName()); return new ComponentName(context.getPackageName(), activityClass.getName());
} }
} }

View File

@@ -175,14 +175,10 @@ public class DashboardFeatureProviderImpl implements DashboardFeatureProvider {
if (fragment instanceof TopLevelSettings if (fragment instanceof TopLevelSettings
&& ActivityEmbeddingUtils.isEmbeddingActivityEnabled(mContext)) { && ActivityEmbeddingUtils.isEmbeddingActivityEnabled(mContext)) {
// Register the rule for injected apps. // Register the rule for injected apps.
ActivityEmbeddingRulesController.registerTwoPanePairRule(mContext, ActivityEmbeddingRulesController.registerTwoPanePairRuleForSettingsHome(
new ComponentName(activity.getPackageName(), mContext,
com.android.settings.Settings.class.getName()), new ComponentName(tile.getPackageName(), tile.getComponentName()),
new ComponentName(tile.getPackageName(),
tile.getComponentName()),
null /* secondaryIntentAction */, null /* secondaryIntentAction */,
true /* finishPrimaryWithSecondary */,
true /* finishSecondaryWithPrimary */,
true /* clearTop */); true /* clearTop */);
// Highlight preference ui. // Highlight preference ui.

View File

@@ -31,6 +31,7 @@ import androidx.preference.Preference;
import androidx.preference.PreferenceScreen; import androidx.preference.PreferenceScreen;
import com.android.settings.R; import com.android.settings.R;
import com.android.settings.activityembedding.ActivityEmbeddingRulesController;
import com.android.settings.activityembedding.ActivityEmbeddingUtils; import com.android.settings.activityembedding.ActivityEmbeddingUtils;
import com.android.settings.core.BasePreferenceController; import com.android.settings.core.BasePreferenceController;
import com.android.settingslib.RestrictedLockUtilsInternal; import com.android.settingslib.RestrictedLockUtilsInternal;
@@ -102,6 +103,11 @@ public class TopLevelWallpaperPreferenceController extends BasePreferenceControl
mContext)) { mContext)) {
intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK); intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK | Intent.FLAG_ACTIVITY_CLEAR_TASK);
} }
ActivityEmbeddingRulesController.registerTwoPanePairRuleForSettingsHome(
mContext,
intent.getComponent(),
null /* secondaryIntentAction */,
true /* clearTop */);
preference.getContext().startActivity(intent); preference.getContext().startActivity(intent);
return true; return true;
} }

View File

@@ -63,6 +63,10 @@ public class SettingsHomepageActivity extends FragmentActivity implements
private static final String TAG = "SettingsHomepageActivity"; private static final String TAG = "SettingsHomepageActivity";
// Additional extra of Settings#ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK.
// Put true value to the intent when startActivity for a deep link intent from this Activity.
public static final String EXTRA_IS_FROM_SETTINGS_HOMEPAGE = "is_from_settings_homepage";
// Additional extra of Settings#ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK. // Additional extra of Settings#ACTION_SETTINGS_LARGE_SCREEN_DEEP_LINK.
// Set & get Uri of the Intent separately to prevent failure of Intent#ParseUri. // Set & get Uri of the Intent separately to prevent failure of Intent#ParseUri.
public static final String EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_DATA = public static final String EXTRA_SETTINGS_LARGE_SCREEN_DEEP_LINK_INTENT_DATA =
@@ -95,7 +99,9 @@ public class SettingsHomepageActivity extends FragmentActivity implements
if (mHomepageView == null) { if (mHomepageView == null) {
return false; return false;
} else { } else {
mLoadedListeners.add(listener); if (!mLoadedListeners.contains(listener)) {
mLoadedListeners.add(listener);
}
return true; return true;
} }
} }
@@ -109,11 +115,13 @@ public class SettingsHomepageActivity extends FragmentActivity implements
return; return;
} }
Log.i(TAG, "showHomepageWithSuggestion: " + showSuggestion); Log.i(TAG, "showHomepageWithSuggestion: " + showSuggestion);
final View homepageView = mHomepageView;
mSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE); mSuggestionView.setVisibility(showSuggestion ? View.VISIBLE : View.GONE);
mHomepageView.setVisibility(View.VISIBLE);
mHomepageView = null; mHomepageView = null;
mLoadedListeners.forEach(listener -> listener.onHomepageLoaded()); mLoadedListeners.forEach(listener -> listener.onHomepageLoaded());
mLoadedListeners.clear(); mLoadedListeners.clear();
homepageView.setVisibility(View.VISIBLE);
} }
@Override @Override
@@ -195,7 +203,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
mSuggestionView = findViewById(R.id.suggestion_content); mSuggestionView = findViewById(R.id.suggestion_content);
mHomepageView = findViewById(R.id.settings_homepage_container); mHomepageView = findViewById(R.id.settings_homepage_container);
// Hide the homepage for preparing the suggestion. // Hide the homepage for preparing the suggestion.
mHomepageView.setVisibility(View.GONE); mHomepageView.setVisibility(View.INVISIBLE);
// Schedule a timer to show the homepage and hide the suggestion on timeout. // Schedule a timer to show the homepage and hide the suggestion on timeout.
mHomepageView.postDelayed(() -> showHomepageWithSuggestion(false), mHomepageView.postDelayed(() -> showHomepageWithSuggestion(false),
HOMEPAGE_LOADING_TIMEOUT_MS); HOMEPAGE_LOADING_TIMEOUT_MS);
@@ -264,6 +272,7 @@ public class SettingsHomepageActivity extends FragmentActivity implements
// Sender of intent may want to send intent extra data to the destination of targetIntent. // Sender of intent may want to send intent extra data to the destination of targetIntent.
targetIntent.replaceExtras(intent); targetIntent.replaceExtras(intent);
targetIntent.putExtra(EXTRA_IS_FROM_SETTINGS_HOMEPAGE, true);
targetIntent.putExtra(SettingsActivity.EXTRA_IS_FROM_SLICE, false); targetIntent.putExtra(SettingsActivity.EXTRA_IS_FROM_SLICE, false);
targetIntent.setData(intent.getParcelableExtra( targetIntent.setData(intent.getParcelableExtra(

View File

@@ -100,7 +100,7 @@ public class TopLevelSettings extends DashboardFragment implements
@Override @Override
public boolean onPreferenceTreeClick(Preference preference) { public boolean onPreferenceTreeClick(Preference preference) {
// Register SplitPairRule for SubSettings. // Register SplitPairRule for SubSettings.
ActivityEmbeddingRulesController.registerSubSettingsPairRuleIfNeeded(getContext(), ActivityEmbeddingRulesController.registerSubSettingsPairRule(getContext(),
true /* clearTop */); true /* clearTop */);
setHighlightPreferenceKey(preference.getKey()); setHighlightPreferenceKey(preference.getKey());
@@ -201,7 +201,8 @@ public class TopLevelSettings extends DashboardFragment implements
@Override @Override
protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) { protected RecyclerView.Adapter onCreateAdapter(PreferenceScreen preferenceScreen) {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(getContext())) { if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(getContext())
|| !(getActivity() instanceof SettingsHomepageActivity)) {
return super.onCreateAdapter(preferenceScreen); return super.onCreateAdapter(preferenceScreen);
} }

View File

@@ -21,6 +21,7 @@ import static android.view.View.ACCESSIBILITY_LIVE_REGION_POLITE;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL; import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_CREDENTIAL;
import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_ID; import static com.android.settings.password.ChooseLockSettingsHelper.EXTRA_KEY_UNIFICATION_PROFILE_ID;
import android.annotation.SuppressLint;
import android.app.Activity; import android.app.Activity;
import android.app.settings.SettingsEnums; import android.app.settings.SettingsEnums;
import android.content.Context; import android.content.Context;
@@ -35,6 +36,7 @@ import android.util.Pair;
import android.util.TypedValue; import android.util.TypedValue;
import android.view.KeyEvent; import android.view.KeyEvent;
import android.view.LayoutInflater; import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.TextView; import android.widget.TextView;
@@ -491,11 +493,18 @@ public class ChooseLockPattern extends SettingsActivity {
getActivity().setTitle(msg); getActivity().setTitle(msg);
} }
@SuppressLint("ClickableViewAccessibility")
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) { Bundle savedInstanceState) {
final GlifLayout layout = (GlifLayout) inflater.inflate( final GlifLayout layout = (GlifLayout) inflater.inflate(
R.layout.choose_lock_pattern, container, false); R.layout.choose_lock_pattern, container, false);
layout.findViewById(R.id.lockPattern).setOnTouchListener((v, event) -> {
if (event.getAction() == MotionEvent.ACTION_DOWN) {
v.getParent().requestDisallowInterceptTouchEvent(true);
}
return false;
});
updateActivityTitle(); updateActivityTitle();
layout.setHeaderText(getActivity().getTitle()); layout.setHeaderText(getActivity().getTitle());
layout.getHeaderTextView().setAccessibilityLiveRegion(ACCESSIBILITY_LIVE_REGION_POLITE); layout.getHeaderTextView().setAccessibilityLiveRegion(ACCESSIBILITY_LIVE_REGION_POLITE);

View File

@@ -94,17 +94,16 @@ public class SearchResultTrampoline extends Activity {
if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)) { if (!ActivityEmbeddingUtils.isEmbeddingActivityEnabled(this)) {
startActivity(intent); startActivity(intent);
} else if (isFromSettingsIntelligence(callingActivity)) { } else if (isSettingsIntelligence(callingActivity)) {
// Register SplitPairRule for SubSettings, set clearTop false to prevent unexpected back // Register SplitPairRule for SubSettings, set clearTop false to prevent unexpected back
// navigation behavior. // navigation behavior.
ActivityEmbeddingRulesController.registerSubSettingsPairRuleIfNeeded(this, ActivityEmbeddingRulesController.registerSubSettingsPairRule(this,
false /* clearTop */); false /* clearTop */);
// TODO: pass menu key to homepage // TODO: pass menu key to homepage
intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK); intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(intent); startActivity(intent);
} else { } else {
// Two-pane case // Two-pane case
intent.setFlags(intent.getFlags() & ~Intent.FLAG_ACTIVITY_NEW_TASK);
startActivity(SettingsActivity.getTrampolineIntent(intent, highlightMenuKey)); startActivity(SettingsActivity.getTrampolineIntent(intent, highlightMenuKey));
} }
@@ -112,7 +111,7 @@ public class SearchResultTrampoline extends Activity {
finish(); finish();
} }
private boolean isFromSettingsIntelligence(ComponentName callingActivity) { private boolean isSettingsIntelligence(ComponentName callingActivity) {
return callingActivity != null && TextUtils.equals( return callingActivity != null && TextUtils.equals(
callingActivity.getPackageName(), callingActivity.getPackageName(),
FeatureFactory.getFactory(this).getSearchFeatureProvider() FeatureFactory.getFactory(this).getSearchFeatureProvider()

View File

@@ -38,7 +38,8 @@ import com.android.settings.homepage.SettingsHomepageActivity;
/** /**
* Adapter for highlighting top level preferences * Adapter for highlighting top level preferences
*/ */
public class HighlightableTopLevelPreferenceAdapter extends PreferenceGroupAdapter { public class HighlightableTopLevelPreferenceAdapter extends PreferenceGroupAdapter implements
SettingsHomepageActivity.HomepageLoadedListener {
private static final String TAG = "HighlightableTopLevelAdapter"; private static final String TAG = "HighlightableTopLevelAdapter";
@@ -60,6 +61,7 @@ public class HighlightableTopLevelPreferenceAdapter extends PreferenceGroupAdapt
private String mHighlightKey; private String mHighlightKey;
private String mPreviousHighlightKey; private String mPreviousHighlightKey;
private int mHighlightPosition = RecyclerView.NO_POSITION; private int mHighlightPosition = RecyclerView.NO_POSITION;
private int mScrollPosition = RecyclerView.NO_POSITION;
private boolean mHighlightNeeded; private boolean mHighlightNeeded;
private boolean mScrolled; private boolean mScrolled;
@@ -135,9 +137,11 @@ public class HighlightableTopLevelPreferenceAdapter extends PreferenceGroupAdapt
return; return;
} }
// Scroll before highlight if needed.
final boolean highlightNeeded = isHighlightNeeded(); final boolean highlightNeeded = isHighlightNeeded();
if (highlightNeeded) { if (highlightNeeded) {
scrollToPositionIfNeeded(position); mScrollPosition = position;
scroll();
} }
// Turn on/off highlight when screen split mode is changed. // Turn on/off highlight when screen split mode is changed.
@@ -189,26 +193,29 @@ public class HighlightableTopLevelPreferenceAdapter extends PreferenceGroupAdapt
requestHighlight(); requestHighlight();
} }
private void scrollToPositionIfNeeded(int position) { @Override
if (mScrolled || position < 0) { public void onHomepageLoaded() {
scroll();
}
private void scroll() {
if (mScrolled || mScrollPosition < 0) {
return; return;
} }
if (mHomepageActivity.registerHomepageLoadedListenerIfNeeded( if (mHomepageActivity.registerHomepageLoadedListenerIfNeeded(this)) {
() -> scrollToPositionIfNeeded(position))) {
return; return;
} }
// Only when the recyclerView is loaded, it can be scrolled // Only when the recyclerView is loaded, it can be scrolled
final View view = mRecyclerView.getChildAt(position); final View view = mRecyclerView.getChildAt(mScrollPosition);
if (view == null) { if (view == null) {
mRecyclerView.postDelayed(() -> scrollToPositionIfNeeded(position), mRecyclerView.postDelayed(() -> scroll(), DELAY_HIGHLIGHT_DURATION_MILLIS);
DELAY_HIGHLIGHT_DURATION_MILLIS);
return; return;
} }
mScrolled = true; mScrolled = true;
Log.d(TAG, "Scroll to position " + position); Log.d(TAG, "Scroll to position " + mScrollPosition);
// Scroll to the top to reset the position. // Scroll to the top to reset the position.
mRecyclerView.nestedScrollBy(0, -mRecyclerView.getHeight()); mRecyclerView.nestedScrollBy(0, -mRecyclerView.getHeight());

View File

@@ -16,7 +16,6 @@
package com.android.settings.wifi; package com.android.settings.wifi;
import static android.Manifest.permission.ACCESS_COARSE_LOCATION;
import static android.Manifest.permission.ACCESS_FINE_LOCATION; import static android.Manifest.permission.ACCESS_FINE_LOCATION;
import android.content.DialogInterface; import android.content.DialogInterface;
@@ -359,12 +358,6 @@ public class WifiDialogActivity extends ObservableActivity implements WifiDialog
return false; return false;
} }
if (getPackageManager().checkPermission(ACCESS_COARSE_LOCATION, callingPackage)
== PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "The calling package has ACCESS_COARSE_LOCATION permission for result.");
return true;
}
if (getPackageManager().checkPermission(ACCESS_FINE_LOCATION, callingPackage) if (getPackageManager().checkPermission(ACCESS_FINE_LOCATION, callingPackage)
== PackageManager.PERMISSION_GRANTED) { == PackageManager.PERMISSION_GRANTED) {
Log.d(TAG, "The calling package has ACCESS_FINE_LOCATION permission for result."); Log.d(TAG, "The calling package has ACCESS_FINE_LOCATION permission for result.");

View File

@@ -31,7 +31,6 @@ import com.android.settings.testutils.DatabaseTestUtils;
import org.junit.After; import org.junit.After;
import org.junit.Before; import org.junit.Before;
import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import org.junit.runner.RunWith; import org.junit.runner.RunWith;
import org.mockito.MockitoAnnotations; import org.mockito.MockitoAnnotations;
@@ -90,7 +89,6 @@ public class BatteryDatabaseManagerTest {
} }
@Test @Test
@Ignore
public void allAnomalyFunctions() { public void allAnomalyFunctions() {
mBatteryDatabaseManager.insertAnomaly(UID_NEW, PACKAGE_NAME_NEW, TYPE_NEW, mBatteryDatabaseManager.insertAnomaly(UID_NEW, PACKAGE_NAME_NEW, TYPE_NEW,
AnomalyDatabaseHelper.State.NEW, NOW); AnomalyDatabaseHelper.State.NEW, NOW);
@@ -116,7 +114,6 @@ public class BatteryDatabaseManagerTest {
} }
@Test @Test
@Ignore
public void updateAnomalies_updateSuccessfully() { public void updateAnomalies_updateSuccessfully() {
mBatteryDatabaseManager.insertAnomaly(UID_NEW, PACKAGE_NAME_NEW, TYPE_NEW, mBatteryDatabaseManager.insertAnomaly(UID_NEW, PACKAGE_NAME_NEW, TYPE_NEW,
AnomalyDatabaseHelper.State.NEW, NOW); AnomalyDatabaseHelper.State.NEW, NOW);
@@ -142,7 +139,6 @@ public class BatteryDatabaseManagerTest {
} }
@Test @Test
@Ignore
public void queryAnomalies_removeDuplicateByUid() { public void queryAnomalies_removeDuplicateByUid() {
mBatteryDatabaseManager.insertAnomaly(UID_NEW, PACKAGE_NAME_NEW, TYPE_NEW, mBatteryDatabaseManager.insertAnomaly(UID_NEW, PACKAGE_NAME_NEW, TYPE_NEW,
AnomalyDatabaseHelper.State.NEW, NOW); AnomalyDatabaseHelper.State.NEW, NOW);
@@ -156,7 +152,6 @@ public class BatteryDatabaseManagerTest {
} }
@Test @Test
@Ignore
public void allActionFunctions() { public void allActionFunctions() {
final long timestamp = System.currentTimeMillis(); final long timestamp = System.currentTimeMillis();
mBatteryDatabaseManager.insertAction(AnomalyDatabaseHelper.ActionType.RESTRICTION, UID_OLD, mBatteryDatabaseManager.insertAction(AnomalyDatabaseHelper.ActionType.RESTRICTION, UID_OLD,

View File

@@ -310,7 +310,7 @@ public class WifiDialogActivityTest {
} }
@Test @Test
public void hasPermissionForResult_hasCoarseLocationPermission_returnTrue() { public void hasPermissionForResult_hasCoarseLocationPermission_returnFalse() {
WifiDialogActivity activity = spy(Robolectric.setupActivity(WifiDialogActivity.class)); WifiDialogActivity activity = spy(Robolectric.setupActivity(WifiDialogActivity.class));
when(activity.getCallingPackage()).thenReturn(CALLING_PACKAGE); when(activity.getCallingPackage()).thenReturn(CALLING_PACKAGE);
when(activity.getPackageManager()).thenReturn(mPackageManager); when(activity.getPackageManager()).thenReturn(mPackageManager);
@@ -321,7 +321,7 @@ public class WifiDialogActivityTest {
final boolean result = activity.hasPermissionForResult(); final boolean result = activity.hasPermissionForResult();
assertThat(result).isTrue(); assertThat(result).isFalse();
} }
@Test @Test