Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ded9a748 authored by Pat Manning's avatar Pat Manning Committed by Android (Google) Code Review
Browse files

Merge "Add launcher metrics for tracking kids nav mode change events." into tm-qpr-dev

parents c863b905 5889bc37
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -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{
+1 −1
Original line number Diff line number Diff line
@@ -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 */
        );
    }

+9 −0
Original line number Diff line number Diff line
@@ -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;
    }