Merge "Revise homepage highlight mechanism" into sc-v2-dev
diff --git a/AndroidManifest.xml b/AndroidManifest.xml
index 67f74be..d4c01fa 100644
--- a/AndroidManifest.xml
+++ b/AndroidManifest.xml
@@ -147,7 +147,7 @@
<!-- Activity for launching deep link page in 2-pane. -->
<activity android:name=".homepage.DeepLinkHomepageActivity"
android:label="@string/settings_label_launcher"
- android:theme="@style/Theme.Settings.Home"
+ android:theme="@style/Theme.Settings.Home.DeepLink"
android:taskAffinity=""
android:launchMode="singleTask"
android:exported="true"
@@ -163,7 +163,7 @@
<activity android:name=".homepage.SliceDeepLinkHomepageActivity"
android:label="@string/settings_label_launcher"
- android:theme="@style/Theme.Settings.Home"
+ android:theme="@style/Theme.Settings.Home.DeepLink"
android:taskAffinity=""
android:launchMode="singleTask"
android:exported="false"
diff --git a/res/layout/accessibility_launch_activity_preference.xml b/res/layout/accessibility_launch_activity_preference.xml
new file mode 100644
index 0000000..772bb84
--- /dev/null
+++ b/res/layout/accessibility_launch_activity_preference.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright (C) 2021 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.
+ -->
+
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:minHeight="@dimen/settingslib_min_switch_bar_height"
+ android:layout_height="wrap_content"
+ android:layout_width="match_parent"
+ android:layout_margin="@dimen/settingslib_switchbar_margin"
+ android:paddingStart="@dimen/settingslib_switchbar_padding_left"
+ android:paddingEnd="@dimen/settingslib_switchbar_padding_right"
+ android:background="@drawable/settingslib_switch_bar_bg_on">
+
+ <TextView
+ android:id="@android:id/title"
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_marginEnd="@dimen/settingslib_switch_title_margin"
+ android:layout_marginVertical="@dimen/settingslib_switch_title_margin"
+ android:layout_gravity="center_vertical"
+ android:ellipsize="end"
+ android:textAppearance="?android:attr/textAppearanceListItem"
+ style="@style/MainSwitchText.Settingslib" />
+</LinearLayout>
diff --git a/res/values/themes.xml b/res/values/themes.xml
index 7c5c111..d65c1b3 100644
--- a/res/values/themes.xml
+++ b/res/values/themes.xml
@@ -220,6 +220,10 @@
<item name="android:statusBarColor">?attr/colorPrimaryDark</item>
</style>
+ <style name="Theme.Settings.Home.DeepLink">
+ <item name="android:windowAnimationStyle">@null</item>
+ </style>
+
<style name="Theme.Settings.ContextualCard" parent="Theme.Settings.Home">
<item name="android:textAppearanceListItem">@style/TextAppearance.HomepageCardTitle</item>
</style>
diff --git a/res/xml/accounts_dashboard_settings_header.xml b/res/xml/accounts_dashboard_settings_header.xml
new file mode 100644
index 0000000..99f0736
--- /dev/null
+++ b/res/xml/accounts_dashboard_settings_header.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:title="@string/account_dashboard_title"
+ settings:searchable="false">
+</PreferenceScreen>
diff --git a/res/xml/location_recent_location_access_header.xml b/res/xml/location_recent_location_access_header.xml
new file mode 100644
index 0000000..219f13e
--- /dev/null
+++ b/res/xml/location_recent_location_access_header.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:title="@string/location_category_recent_location_access"
+ settings:searchable="false">
+</PreferenceScreen>
diff --git a/res/xml/location_recent_requests_header.xml b/res/xml/location_recent_requests_header.xml
new file mode 100644
index 0000000..0e252a5
--- /dev/null
+++ b/res/xml/location_recent_requests_header.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:title="@string/location_category_recent_location_requests"
+ settings:searchable="false">
+</PreferenceScreen>
diff --git a/res/xml/location_services_header.xml b/res/xml/location_services_header.xml
new file mode 100644
index 0000000..4eaf2c5
--- /dev/null
+++ b/res/xml/location_services_header.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:title="@string/location_services_preference_title"
+ settings:searchable="false">
+</PreferenceScreen>
diff --git a/res/xml/location_settings_header.xml b/res/xml/location_settings_header.xml
new file mode 100644
index 0000000..4749a2e
--- /dev/null
+++ b/res/xml/location_settings_header.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2021 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.
+-->
+
+<PreferenceScreen
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ xmlns:settings="http://schemas.android.com/apk/res-auto"
+ android:title="@string/location_settings_title"
+ settings:searchable="false">
+</PreferenceScreen>
diff --git a/src/com/android/settings/accessibility/LaunchAccessibilityActivityPreferenceFragment.java b/src/com/android/settings/accessibility/LaunchAccessibilityActivityPreferenceFragment.java
index 3b15830..9666fe9 100644
--- a/src/com/android/settings/accessibility/LaunchAccessibilityActivityPreferenceFragment.java
+++ b/src/com/android/settings/accessibility/LaunchAccessibilityActivityPreferenceFragment.java
@@ -150,6 +150,7 @@
private void initLaunchPreference() {
final Preference launchPreference = new Preference(getPrefContext());
+ launchPreference.setLayoutResource(R.layout.accessibility_launch_activity_preference);
launchPreference.setKey(KEY_LAUNCH_PREFERENCE);
final AccessibilityShortcutInfo info = getAccessibilityShortcutInfo();
diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java
index edd4088..d20e570 100644
--- a/src/com/android/settings/applications/manageapplications/ManageApplications.java
+++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java
@@ -272,8 +272,8 @@
Intent intent = activity.getIntent();
Bundle args = getArguments();
- int screenTitle = intent.getIntExtra(
- SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.all_apps);
+ final int screenTitle = getTitleResId(intent, args);
+
String className = args != null ? args.getString(EXTRA_CLASSNAME) : null;
if (className == null) {
className = intent.getComponent().getClassName();
@@ -290,49 +290,36 @@
mSortOrder = R.id.sort_order_size;
} else if (className.equals(UsageAccessSettingsActivity.class.getName())) {
mListType = LIST_TYPE_USAGE_ACCESS;
- screenTitle = R.string.usage_access;
} else if (className.equals(HighPowerApplicationsActivity.class.getName())) {
mListType = LIST_TYPE_HIGH_POWER;
// Default to showing system.
mShowSystem = true;
- screenTitle = R.string.high_power_apps;
} else if (className.equals(OverlaySettingsActivity.class.getName())) {
mListType = LIST_TYPE_OVERLAY;
- screenTitle = R.string.system_alert_window_settings;
reportIfRestrictedSawIntent(intent);
} else if (className.equals(WriteSettingsActivity.class.getName())) {
mListType = LIST_TYPE_WRITE_SETTINGS;
- screenTitle = R.string.write_settings;
} else if (className.equals(ManageExternalSourcesActivity.class.getName())) {
mListType = LIST_TYPE_MANAGE_SOURCES;
- screenTitle = R.string.install_other_apps;
} else if (className.equals(GamesStorageActivity.class.getName())) {
mListType = LIST_TYPE_GAMES;
mSortOrder = R.id.sort_order_size;
} else if (className.equals(Settings.ChangeWifiStateActivity.class.getName())) {
mListType = LIST_TYPE_WIFI_ACCESS;
- screenTitle = R.string.change_wifi_state_title;
} else if (className.equals(Settings.ManageExternalStorageActivity.class.getName())) {
mListType = LIST_MANAGE_EXTERNAL_STORAGE;
- screenTitle = R.string.manage_external_storage_title;
} else if (className.equals(Settings.MediaManagementAppsActivity.class.getName())) {
mListType = LIST_TYPE_MEDIA_MANAGEMENT_APPS;
- screenTitle = R.string.media_management_apps_title;
} else if (className.equals(Settings.AlarmsAndRemindersActivity.class.getName())) {
mListType = LIST_TYPE_ALARMS_AND_REMINDERS;
- screenTitle = R.string.alarms_and_reminders_title;
} else if (className.equals(Settings.NotificationAppListActivity.class.getName())) {
mListType = LIST_TYPE_NOTIFICATION;
mUsageStatsManager = IUsageStatsManager.Stub.asInterface(
ServiceManager.getService(Context.USAGE_STATS_SERVICE));
mNotificationBackend = new NotificationBackend();
mSortOrder = R.id.sort_order_recent_notification;
- screenTitle = R.string.app_notifications_title;
} else {
- if (screenTitle == -1) {
- screenTitle = R.string.all_apps;
- }
mListType = LIST_TYPE_MAIN;
}
final AppFilterRegistry appFilterRegistry = AppFilterRegistry.getInstance();
@@ -881,6 +868,46 @@
params.setBehavior(behavior);
}
+ /**
+ * Returns a resource ID of title based on what type of app list is
+ * @param intent the intent of the activity that might include a specified title
+ * @param args the args that includes a class name of app list
+ */
+ public static int getTitleResId(@NonNull Intent intent, Bundle args) {
+ int screenTitle = intent.getIntExtra(
+ SettingsActivity.EXTRA_SHOW_FRAGMENT_TITLE_RESID, R.string.all_apps);
+ String className = args != null ? args.getString(EXTRA_CLASSNAME) : null;
+ if (className == null) {
+ className = intent.getComponent().getClassName();
+ }
+ if (className.equals(Settings.UsageAccessSettingsActivity.class.getName())) {
+ screenTitle = R.string.usage_access;
+ } else if (className.equals(Settings.HighPowerApplicationsActivity.class.getName())) {
+ screenTitle = R.string.high_power_apps;
+ } else if (className.equals(Settings.OverlaySettingsActivity.class.getName())) {
+ screenTitle = R.string.system_alert_window_settings;
+ } else if (className.equals(Settings.WriteSettingsActivity.class.getName())) {
+ screenTitle = R.string.write_settings;
+ } else if (className.equals(Settings.ManageExternalSourcesActivity.class.getName())) {
+ screenTitle = R.string.install_other_apps;
+ } else if (className.equals(Settings.ChangeWifiStateActivity.class.getName())) {
+ screenTitle = R.string.change_wifi_state_title;
+ } else if (className.equals(Settings.ManageExternalStorageActivity.class.getName())) {
+ screenTitle = R.string.manage_external_storage_title;
+ } else if (className.equals(Settings.MediaManagementAppsActivity.class.getName())) {
+ screenTitle = R.string.media_management_apps_title;
+ } else if (className.equals(Settings.AlarmsAndRemindersActivity.class.getName())) {
+ screenTitle = R.string.alarms_and_reminders_title;
+ } else if (className.equals(Settings.NotificationAppListActivity.class.getName())) {
+ screenTitle = R.string.app_notifications_title;
+ } else {
+ if (screenTitle == -1) {
+ screenTitle = R.string.all_apps;
+ }
+ }
+ return screenTitle;
+ }
+
static class FilterSpinnerAdapter extends SettingsSpinnerAdapter<CharSequence> {
private final ManageApplications mManageApplications;
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectAccountFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectAccountFragment.java
index ac67b58..cf91031 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectAccountFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectAccountFragment.java
@@ -17,6 +17,7 @@
package com.android.settings.dashboard.profileselector;
import androidx.fragment.app.Fragment;
+import com.android.settings.R;
import com.android.settings.accounts.AccountPersonalDashboardFragment;
import com.android.settings.accounts.AccountWorkProfileDashboardFragment;
@@ -32,4 +33,9 @@
new AccountWorkProfileDashboardFragment()
};
}
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.accounts_dashboard_settings_header;
+ }
}
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
index 82d524d..79a4b87 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectFragment.java
@@ -107,6 +107,10 @@
Bundle savedInstanceState) {
mContentView = (ViewGroup) super.onCreateView(inflater, container, savedInstanceState);
final Activity activity = getActivity();
+ final int titleResId = getTitleResId();
+ if (titleResId > 0) {
+ activity.setTitle(titleResId);
+ }
final int selectedTab = convertPosition(getTabId(activity, getArguments()));
final View tabContainer = mContentView.findViewById(R.id.tab_container);
@@ -166,6 +170,14 @@
*/
public abstract Fragment[] getFragments();
+ /**
+ * Returns a resource ID of the title
+ * Override this if the title needs to be updated dynamically.
+ */
+ int getTitleResId() {
+ return 0;
+ }
+
@Override
protected int getPreferenceScreenResId() {
return R.xml.placeholder_preference_screen;
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationFragment.java
index e4cde8e..28fb97b 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationFragment.java
@@ -60,4 +60,9 @@
workFragment
};
}
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.location_settings_header;
+ }
}
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationServicesFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationServicesFragment.java
index b6f03d6..5f25f59 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationServicesFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectLocationServicesFragment.java
@@ -20,6 +20,7 @@
import androidx.fragment.app.Fragment;
+import com.android.settings.R;
import com.android.settings.location.LocationServices;
import com.android.settings.location.LocationServicesForWork;
@@ -44,4 +45,9 @@
workFragment
};
}
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.location_services_header;
+ }
}
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java
index 17fed11..cbd1fe3 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectManageApplications.java
@@ -16,6 +16,8 @@
package com.android.settings.dashboard.profileselector;
+import android.app.Activity;
+import android.content.Intent;
import android.os.Bundle;
import androidx.fragment.app.Fragment;
@@ -43,4 +45,12 @@
workFragment
};
}
+
+ @Override
+ int getTitleResId() {
+ final Activity activity = getActivity();
+ final Intent intent = activity.getIntent();
+ final Bundle args = getArguments();
+ return ManageApplications.getTitleResId(intent, args);
+ }
}
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationAccessFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationAccessFragment.java
index 3cb77c5..d9b9ba4 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationAccessFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationAccessFragment.java
@@ -20,6 +20,7 @@
import androidx.fragment.app.Fragment;
+import com.android.settings.R;
import com.android.settings.location.RecentLocationAccessSeeAllFragment;
/**
@@ -43,4 +44,9 @@
workFragment
};
}
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.location_recent_location_access_header;
+ }
}
diff --git a/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationRequestFragment.java b/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationRequestFragment.java
index 058ffe4..16cb43c 100644
--- a/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationRequestFragment.java
+++ b/src/com/android/settings/dashboard/profileselector/ProfileSelectRecentLocationRequestFragment.java
@@ -20,6 +20,7 @@
import androidx.fragment.app.Fragment;
+import com.android.settings.R;
import com.android.settings.location.RecentLocationRequestSeeAllFragment;
/**
@@ -43,4 +44,9 @@
workFragment
};
}
+
+ @Override
+ protected int getPreferenceScreenResId() {
+ return R.xml.location_recent_requests_header;
+ }
}
diff --git a/src/com/android/settings/security/InstallCaCertificateWarning.java b/src/com/android/settings/security/InstallCaCertificateWarning.java
index 3854875..139bc1c 100644
--- a/src/com/android/settings/security/InstallCaCertificateWarning.java
+++ b/src/com/android/settings/security/InstallCaCertificateWarning.java
@@ -16,6 +16,8 @@
package com.android.settings.security;
+import static android.view.WindowManager.LayoutParams.SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS;
+
import android.annotation.Nullable;
import android.app.Activity;
import android.content.Intent;
@@ -45,6 +47,8 @@
setTheme(SetupWizardUtils.getTheme(this, getIntent()));
ThemeHelper.trySetDynamicColor(this);
setContentView(R.layout.ca_certificate_warning_dialog);
+ getWindow().addSystemFlags(SYSTEM_FLAG_HIDE_NON_SYSTEM_OVERLAY_WINDOWS);
+
final GlifLayout layout = findViewById(R.id.setup_wizard_layout);
layout.setHeaderText(R.string.ca_certificate_warning_title);
@@ -57,6 +61,7 @@
.setTheme(R.style.SudGlifButton_Secondary)
.build()
);
+ mixin.getSecondaryButtonView().setFilterTouchesWhenObscured(true);
mixin.setPrimaryButton(
new FooterButton.Builder(this)
@@ -66,6 +71,7 @@
.setTheme(R.style.SudGlifButton_Primary)
.build()
);
+ mixin.getPrimaryButtonView().setFilterTouchesWhenObscured(true);
}
private View.OnClickListener installCaCertificate() {