Support highlighting the menu entry for Search results
1. Add a receiver to monitor the search state 2. Shoe/hide the menu highlight in the listener 3. Highlight the menu entry in SearchResultTrampoline 4. Enable/disable the receiver in SettingsInitialize Bug: 205781792 Test: manual, robotest Change-Id: Ia04901f504172f4f0c7b4b2ea7eda5f3713f676d
This commit is contained in:
@@ -41,6 +41,7 @@ import androidx.window.embedding.SplitController;
|
||||
|
||||
import com.android.settings.Settings.CreateShortcutActivity;
|
||||
import com.android.settings.homepage.SettingsHomepageActivity;
|
||||
import com.android.settings.search.SearchStateReceiver;
|
||||
import com.android.settingslib.utils.ThreadUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -67,7 +68,7 @@ public class SettingsInitialize extends BroadcastReceiver {
|
||||
managedProfileSetup(context, pm, broadcast, userInfo);
|
||||
webviewSettingSetup(context, pm, userInfo);
|
||||
ThreadUtils.postOnBackgroundThread(() -> refreshExistingShortcuts(context));
|
||||
enableTwoPaneDeepLinkActivityIfNecessary(pm, broadcast);
|
||||
enableTwoPaneDeepLinkActivityIfNecessary(pm, context);
|
||||
}
|
||||
|
||||
private void managedProfileSetup(Context context, final PackageManager pm, Intent broadcast,
|
||||
@@ -148,12 +149,16 @@ public class SettingsInitialize extends BroadcastReceiver {
|
||||
shortcutManager.updateShortcuts(updates);
|
||||
}
|
||||
|
||||
private void enableTwoPaneDeepLinkActivityIfNecessary(PackageManager pm, Intent intent) {
|
||||
private void enableTwoPaneDeepLinkActivityIfNecessary(PackageManager pm, Context context) {
|
||||
final ComponentName deepLinkHome = new ComponentName(Utils.SETTINGS_PACKAGE_NAME,
|
||||
SettingsHomepageActivity.ALIAS_DEEP_LINK);
|
||||
final ComponentName searchStateReceiver = new ComponentName(context,
|
||||
SearchStateReceiver.class);
|
||||
final int enableState = SplitController.getInstance().isSplitSupported()
|
||||
? PackageManager.COMPONENT_ENABLED_STATE_ENABLED
|
||||
: PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
|
||||
pm.setComponentEnabledSetting(deepLinkHome, enableState, PackageManager.DONT_KILL_APP);
|
||||
pm.setComponentEnabledSetting(searchStateReceiver, enableState,
|
||||
PackageManager.DONT_KILL_APP);
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user