From 353ce6f4e98ad3067c4171894aefb2b203959ae9 Mon Sep 17 00:00:00 2001 From: Edgar Wang Date: Fri, 1 Apr 2022 02:35:36 +0800 Subject: [PATCH 1/2] Enable hyphenation on most of preference. Bug: 217659992 Bug: 231924943 Test: manual Change-Id: I1039fbc6c0573c8ce533594a039579b4c8b00e52 --- res/layout/accessibility_launch_activity_preference.xml | 1 + res/layout/accessibility_shortcut_secondary_action.xml | 2 ++ res/layout/apn_preference_layout.xml | 1 + res/layout/app_preference_item.xml | 2 ++ res/layout/battery_active_view.xml | 1 + res/layout/homepage_preference.xml | 2 ++ res/layout/horizontal_preference.xml | 2 ++ res/layout/notification_app.xml | 2 ++ res/layout/preference_app_restrictions.xml | 2 ++ res/layout/preference_balance_slider.xml | 1 + res/layout/preference_icon.xml | 1 + res/layout/preference_labeled_slider.xml | 2 ++ res/layout/preference_multiline_title.xml | 2 ++ res/layout/preference_progress_category.xml | 1 + res/layout/preference_radio_with_extra_widget.xml | 1 + res/layout/preference_single_target.xml | 1 + res/layout/preference_two_target_radio.xml | 1 + res/layout/radio_with_summary.xml | 2 ++ res/layout/running_services_app_item.xml | 2 ++ res/layout/settings_summary_preference.xml | 2 ++ src/com/android/settings/core/SettingsBaseActivity.java | 3 +++ 21 files changed, 34 insertions(+) diff --git a/res/layout/accessibility_launch_activity_preference.xml b/res/layout/accessibility_launch_activity_preference.xml index 772bb846c56..0e3e2251d44 100644 --- a/res/layout/accessibility_launch_activity_preference.xml +++ b/res/layout/accessibility_launch_activity_preference.xml @@ -33,5 +33,6 @@ android:layout_gravity="center_vertical" android:ellipsize="end" android:textAppearance="?android:attr/textAppearanceListItem" + android:hyphenationFrequency="normalFast" style="@style/MainSwitchText.Settingslib" /> diff --git a/res/layout/accessibility_shortcut_secondary_action.xml b/res/layout/accessibility_shortcut_secondary_action.xml index bdb129f83e0..ddbadb5b911 100644 --- a/res/layout/accessibility_shortcut_secondary_action.xml +++ b/res/layout/accessibility_shortcut_secondary_action.xml @@ -59,6 +59,7 @@ android:layout_height="wrap_content" android:singleLine="true" android:textAppearance="?android:attr/textAppearanceListItem" + android:hyphenationFrequency="normalFast" android:ellipsize="marquee" /> diff --git a/res/layout/apn_preference_layout.xml b/res/layout/apn_preference_layout.xml index 4d984435f68..2c453aa591e 100644 --- a/res/layout/apn_preference_layout.xml +++ b/res/layout/apn_preference_layout.xml @@ -51,6 +51,7 @@ android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:textColor="?android:attr/textColorSecondary" android:focusable="false" + android:hyphenationFrequency="normalFast" android:maxLines="2" /> diff --git a/res/layout/app_preference_item.xml b/res/layout/app_preference_item.xml index 85d6bb04bbe..c6857604c79 100755 --- a/res/layout/app_preference_item.xml +++ b/res/layout/app_preference_item.xml @@ -56,6 +56,7 @@ android:paddingEnd="7dip" android:ellipsize="marquee" android:duplicateParentState="true" + android:hyphenationFrequency="normalFast" /> diff --git a/res/layout/horizontal_preference.xml b/res/layout/horizontal_preference.xml index e50fc3f0c00..d87963cc446 100644 --- a/res/layout/horizontal_preference.xml +++ b/res/layout/horizontal_preference.xml @@ -30,6 +30,7 @@ android:textAppearance="?android:attr/textAppearanceListItem" android:layout_height="wrap_content" android:layout_width="wrap_content" + android:hyphenationFrequency="normalFast" android:layout_weight="1" /> diff --git a/res/layout/notification_app.xml b/res/layout/notification_app.xml index 54060c1a91e..2d17c8d9b15 100644 --- a/res/layout/notification_app.xml +++ b/res/layout/notification_app.xml @@ -38,6 +38,7 @@ android:ellipsize="end" android:singleLine="true" android:textAlignment="viewStart" + android:hyphenationFrequency="normalFast" android:textAppearance="?android:attr/textAppearanceMedium" /> diff --git a/res/layout/preference_balance_slider.xml b/res/layout/preference_balance_slider.xml index 7f1e809d37b..3f1c4edfb9d 100644 --- a/res/layout/preference_balance_slider.xml +++ b/res/layout/preference_balance_slider.xml @@ -45,6 +45,7 @@ android:textAppearance="?android:attr/textAppearanceListItem" android:textColor="?android:attr/textColorPrimary" android:ellipsize="marquee" + android:hyphenationFrequency="normalFast" android:fadingEdge="horizontal"/> diff --git a/res/layout/preference_labeled_slider.xml b/res/layout/preference_labeled_slider.xml index 294b9794c0c..610b79f1e13 100644 --- a/res/layout/preference_labeled_slider.xml +++ b/res/layout/preference_labeled_slider.xml @@ -35,6 +35,7 @@ android:fadingEdge="horizontal" android:singleLine="true" android:textAppearance="?android:attr/textAppearanceListItem" + android:hyphenationFrequency="normalFast" android:textColor="?android:attr/textColorPrimary" /> diff --git a/res/layout/preference_progress_category.xml b/res/layout/preference_progress_category.xml index 9a22c545316..9e33c5d4476 100644 --- a/res/layout/preference_progress_category.xml +++ b/res/layout/preference_progress_category.xml @@ -47,6 +47,7 @@ android:layout_weight="1" android:layout_gravity="start|center" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Body2" + android:hyphenationFrequency="normalFast" android:textColor="?android:attr/colorAccent"/> diff --git a/res/layout/preference_two_target_radio.xml b/res/layout/preference_two_target_radio.xml index dc97f1d8785..e5e6d4a3a00 100644 --- a/res/layout/preference_two_target_radio.xml +++ b/res/layout/preference_two_target_radio.xml @@ -73,6 +73,7 @@ android:layout_alignStart="@android:id/title" android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:textColor="?android:attr/textColorSecondary" + android:hyphenationFrequency="normalFast" android:maxLines="10" /> diff --git a/res/layout/radio_with_summary.xml b/res/layout/radio_with_summary.xml index 5b89591a464..2f39e6746c9 100644 --- a/res/layout/radio_with_summary.xml +++ b/res/layout/radio_with_summary.xml @@ -33,6 +33,7 @@ android:gravity="center_vertical" android:paddingStart="20dp" android:drawableStart="?android:attr/listChoiceIndicatorSingle" + android:hyphenationFrequency="normalFast" android:ellipsize="marquee" /> @@ -43,6 +44,7 @@ android:paddingStart="52dp" android:textAppearance="?android:attr/textAppearanceListItemSecondary" android:textColor="?android:attr/textColorSecondary" + android:hyphenationFrequency="normalFast" android:maxLines="10" /> diff --git a/res/layout/running_services_app_item.xml b/res/layout/running_services_app_item.xml index 705d7141e4d..f2585303aea 100644 --- a/res/layout/running_services_app_item.xml +++ b/res/layout/running_services_app_item.xml @@ -55,6 +55,7 @@ android:ellipsize="marquee" android:fadingEdge="horizontal" android:maxLines="2" + android:hyphenationFrequency="normalFast" android:textAppearance="?android:attr/textAppearanceListItem"/> diff --git a/res/layout/settings_summary_preference.xml b/res/layout/settings_summary_preference.xml index 61f27ca9b53..2f899e170f9 100644 --- a/res/layout/settings_summary_preference.xml +++ b/res/layout/settings_summary_preference.xml @@ -32,6 +32,7 @@ android:paddingTop="0dp" android:textColor="?android:attr/textColorPrimary" android:textAppearance="@*android:style/TextAppearance.DeviceDefault.Display1" + android:hyphenationFrequency="normalFast" /> Date: Mon, 30 May 2022 01:01:55 +0800 Subject: [PATCH 2/2] Enable Kotlin for Settings App Currently Kotlin files cannot build with library app-compat-annotations. Only one @ChangeId need this library, create separate build target library Settings-change-ids to solve this issue. After this cl, Kotlin could be used for Settings App. Fix: 229037247 Test: make Settings Change-Id: I4a0d99425c9e6cc2cbc015d2561daa68609ca0fd --- Android.bp | 15 ++++++-- src/com/android/settings/ChangeIds.java | 35 +++++++++++++++++++ .../ManageApplications.java | 13 +------ 3 files changed, 48 insertions(+), 15 deletions(-) create mode 100644 src/com/android/settings/ChangeIds.java diff --git a/Android.bp b/Android.bp index 619a390d8b8..5bf5514cbc4 100644 --- a/Android.bp +++ b/Android.bp @@ -35,6 +35,15 @@ java_library { ], } +java_library { + name: "Settings-change-ids", + srcs: ["src/com/android/settings/ChangeIds.java"], + libs: [ + "app-compat-annotations", + ], +} + + // Build the Settings APK android_library { name: "Settings-core", @@ -77,18 +86,18 @@ android_library { "lottie", "WifiTrackerLib", "SettingsLibActivityEmbedding", + "Settings-change-ids", ], libs: [ "telephony-common", "ims-common", - "app-compat-annotations", ], } platform_compat_config { name: "settings-platform-compat-config", - src: ":Settings-core", + src: ":Settings-change-ids", system_ext_specific: true, } @@ -126,7 +135,7 @@ filegroup { // over all the sources together. filegroup { name: "Settings_srcs", - srcs: ["src/**/*.java"], + srcs: ["src/**/*.java", "src/**/*.kt"], } filegroup { diff --git a/src/com/android/settings/ChangeIds.java b/src/com/android/settings/ChangeIds.java new file mode 100644 index 00000000000..1f772016d5f --- /dev/null +++ b/src/com/android/settings/ChangeIds.java @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2022 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; + +import android.compat.annotation.ChangeId; +import android.compat.annotation.LoggingOnly; + +/** + * All the {@link ChangeId} used for Settings App. + */ +public class ChangeIds { + /** + * Intents with action {@code android.settings.MANAGE_APP_OVERLAY_PERMISSION} + * and data URI scheme {@code package} don't go to the app-specific screen for managing the + * permission anymore. Instead, they redirect to this screen for managing all the apps that have + * requested such permission. + */ + @ChangeId + @LoggingOnly + public static final long CHANGE_RESTRICT_SAW_INTENT = 135920175L; +} diff --git a/src/com/android/settings/applications/manageapplications/ManageApplications.java b/src/com/android/settings/applications/manageapplications/ManageApplications.java index ead9840af7a..e12bc1cc76a 100644 --- a/src/com/android/settings/applications/manageapplications/ManageApplications.java +++ b/src/com/android/settings/applications/manageapplications/ManageApplications.java @@ -18,6 +18,7 @@ package com.android.settings.applications.manageapplications; import static androidx.recyclerview.widget.RecyclerView.SCROLL_STATE_IDLE; +import static com.android.settings.ChangeIds.CHANGE_RESTRICT_SAW_INTENT; import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_ALL; import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_BLOCKED; import static com.android.settings.applications.manageapplications.AppFilterRegistry.FILTER_APPS_DISABLED; @@ -37,8 +38,6 @@ import android.app.Activity; import android.app.ActivityManager; import android.app.settings.SettingsEnums; import android.app.usage.IUsageStatsManager; -import android.compat.annotation.ChangeId; -import android.compat.annotation.LoggingOnly; import android.content.Context; import android.content.Intent; import android.content.pm.ApplicationInfo; @@ -190,16 +189,6 @@ public class ManageApplications extends InstrumentedFragment public static final int STORAGE_TYPE_DEFAULT = 0; // Show all apps that are not categorized. public static final int STORAGE_TYPE_LEGACY = 1; // Show apps even if they can be categorized. - /** - * Intents with action {@code android.settings.MANAGE_APP_OVERLAY_PERMISSION} - * and data URI scheme {@code package} don't go to the app-specific screen for managing the - * permission anymore. Instead, they redirect to this screen for managing all the apps that have - * requested such permission. - */ - @ChangeId - @LoggingOnly - private static final long CHANGE_RESTRICT_SAW_INTENT = 135920175L; - // sort order @VisibleForTesting int mSortOrder = R.id.sort_order_alpha;