mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-03-04 09:56:49 +00:00
Merge "Add launcher metrics for tracking kids nav mode change events." into tm-qpr-dev
This commit is contained in:
@@ -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{
|
||||
|
||||
@@ -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 */
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user