mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-03 17:36:49 +00:00
Register SimpleBroadcastReceiver permission.
Update SimpleBroadcastReceiver API to pass in broadcast permission and register Growth Broadcast Receiver with permission to prevent other apps from triggering Growth Nudge on their behalf. Flag: EXEMPT add separately Test: Manual Bug: 397739323 Change-Id: I3a9d5e131ced752af0a1b35d400eed6d170fc81e
This commit is contained in:
@@ -26,6 +26,7 @@ import static com.android.launcher3.Flags.enableUnfoldStateAnimation;
|
||||
import static com.android.launcher3.config.FeatureFlags.ENABLE_TASKBAR_NAVBAR_UNIFICATION;
|
||||
import static com.android.launcher3.config.FeatureFlags.enableTaskbarNoRecreate;
|
||||
import static com.android.launcher3.taskbar.growth.GrowthConstants.BROADCAST_SHOW_NUDGE;
|
||||
import static com.android.launcher3.taskbar.growth.GrowthConstants.GROWTH_NUDGE_PERMISSION;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_DENSITY;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_DESKTOP_MODE;
|
||||
import static com.android.launcher3.util.DisplayController.CHANGE_NAVIGATION_MODE;
|
||||
@@ -442,7 +443,7 @@ public class TaskbarManager {
|
||||
mGrowthBroadcastReceiver =
|
||||
new SimpleBroadcastReceiver(
|
||||
mPrimaryWindowContext, UI_HELPER_EXECUTOR, this::showGrowthNudge);
|
||||
mGrowthBroadcastReceiver.register(RECEIVER_EXPORTED,
|
||||
mGrowthBroadcastReceiver.register(null, GROWTH_NUDGE_PERMISSION, RECEIVER_EXPORTED,
|
||||
BROADCAST_SHOW_NUDGE);
|
||||
} else {
|
||||
mGrowthBroadcastReceiver = null;
|
||||
@@ -504,7 +505,7 @@ public class TaskbarManager {
|
||||
debugPrimaryTaskbar("destroyTaskbarForDisplay");
|
||||
// TODO: make this code displayId specific
|
||||
TaskbarActivityContext taskbar = getTaskbarForDisplay(getDefaultDisplayId());
|
||||
if (ACTION_SHOW_TASKBAR.equals(intent.getAction())) {
|
||||
if (ACTION_SHOW_TASKBAR.equals(intent.getAction()) && taskbar != null) {
|
||||
taskbar.showTaskbarFromBroadcast();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -24,5 +24,13 @@ public final class GrowthConstants {
|
||||
*/
|
||||
public static final String BROADCAST_SHOW_NUDGE =
|
||||
"com.android.launcher3.growth.BROADCAST_SHOW_NUDGE";
|
||||
|
||||
/**
|
||||
* For filtering package of broadcast intent received.
|
||||
*/
|
||||
public static final String GROWTH_NUDGE_PERMISSION =
|
||||
"com.android.growth.permission.GROWTH_NUDGE_PERMISSION"
|
||||
+ " android:protectionLevel=\"signature|preinstalled\"";
|
||||
|
||||
private GrowthConstants() {}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user