diff --git a/protos/launcher_atom.proto b/protos/launcher_atom.proto index 10eedc8578..151ec5a93c 100644 --- a/protos/launcher_atom.proto +++ b/protos/launcher_atom.proto @@ -45,6 +45,9 @@ message ItemInfo { // Stores the origin of the Item repeated Attribute item_attributes = 12; + + // Stores whether the navigation bar is in kids mode. + optional bool is_kids_mode = 13; } message LauncherAttributes{ diff --git a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java index a9ff0fb07f..0c422a0595 100644 --- a/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java +++ b/quickstep/src/com/android/quickstep/logging/StatsLogCompatManager.java @@ -191,7 +191,7 @@ public class StatsLogCompatManager extends StatsLogManager { info.getWidget().getSpanX(), // span_x = 17 [default = 1]; info.getWidget().getSpanY(), // span_y = 18 [default = 1]; getAttributes(info) /* attributes = 19 [(log_mode) = MODE_BYTES] */, - false /* is_kids_mode = 20 */ + info.getIsKidsMode() /* is_kids_mode = 20 */ ); } diff --git a/src/com/android/launcher3/model/data/ItemInfo.java b/src/com/android/launcher3/model/data/ItemInfo.java index a8e9eb5162..159af60a0f 100644 --- a/src/com/android/launcher3/model/data/ItemInfo.java +++ b/src/com/android/launcher3/model/data/ItemInfo.java @@ -39,8 +39,10 @@ import static com.android.launcher3.shortcuts.ShortcutKey.EXTRA_SHORTCUT_ID; import android.content.ComponentName; import android.content.ContentValues; import android.content.Intent; +import android.net.Uri; import android.os.Process; import android.os.UserHandle; +import android.provider.Settings; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -61,6 +63,7 @@ import com.android.launcher3.logger.LauncherAtom.WallpapersContainer; import com.android.launcher3.logger.LauncherAtomExtensions.ExtendedContainers; import com.android.launcher3.model.ModelWriter; import com.android.launcher3.util.ContentWriter; +import com.android.launcher3.util.SettingsCache; import java.util.Optional; @@ -74,6 +77,9 @@ public class ItemInfo { // An id that doesn't match any item, including predicted apps with have an id=NO_ID public static final int NO_MATCHING_ID = Integer.MIN_VALUE; + /** Hidden field Settings.Secure.NAV_BAR_KIDS_MODE */ + private static final Uri NAV_BAR_KIDS_MODE = Settings.Secure.getUriFor("nav_bar_kids_mode"); + /** * The id in the settings database for this item */ @@ -390,6 +396,9 @@ public class ItemInfo { protected LauncherAtom.ItemInfo.Builder getDefaultItemInfoBuilder() { LauncherAtom.ItemInfo.Builder itemBuilder = LauncherAtom.ItemInfo.newBuilder(); itemBuilder.setIsWork(!Process.myUserHandle().equals(user)); + SettingsCache settingsCache = SettingsCache.INSTANCE.getNoCreate(); + boolean isKidsMode = settingsCache != null && settingsCache.getValue(NAV_BAR_KIDS_MODE, 0); + itemBuilder.setIsKidsMode(isKidsMode); itemBuilder.setRank(rank); return itemBuilder; }