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

Commit 8eee997d authored by android-build-team Robot's avatar android-build-team Robot
Browse files

Snap for 6978884 from 312e70e1 to rvc-qpr2-release

Change-Id: Id9e7c03845b246445883d9402b1f00471c6fee4f
parents 26e76d86 312e70e1
Loading
Loading
Loading
Loading
+3 −0
Original line number Original line Diff line number Diff line
@@ -3038,6 +3038,9 @@ message BackGesture {
    optional int32 end_y = 7;  // Y coordinate for ACTION_MOVE event.
    optional int32 end_y = 7;  // Y coordinate for ACTION_MOVE event.
    optional int32 left_boundary = 8;  // left edge width + left inset
    optional int32 left_boundary = 8;  // left edge width + left inset
    optional int32 right_boundary = 9;  // screen width - (right edge width + right inset)
    optional int32 right_boundary = 9;  // screen width - (right edge width + right inset)
    // The score between 0 and 1 which is the prediction output for the Back Gesture model.
    optional float ml_model_score = 10;
    optional string package_name = 11;  // The name of the top 100 most used package by all users.


    enum WindowHorizontalLocation {
    enum WindowHorizontalLocation {
        DEFAULT_LOCATION = 0;
        DEFAULT_LOCATION = 0;
+16 −0
Original line number Original line Diff line number Diff line
@@ -428,6 +428,22 @@ public final class SystemUiDeviceConfigFlags {
     */
     */
    public static final String SCREENSHOT_KEYCHORD_DELAY = "screenshot_keychord_delay";
    public static final String SCREENSHOT_KEYCHORD_DELAY = "screenshot_keychord_delay";


    /**
     * (boolean) Whether to use an ML model for the Back Gesture.
     */
    public static final String USE_BACK_GESTURE_ML_MODEL = "use_back_gesture_ml_model";

    /**
     * (string) The name of the ML model for Back Gesture.
     */
    public static final String BACK_GESTURE_ML_MODEL_NAME = "back_gesture_ml_model_name";

    /**
     * (float) Threshold for Back Gesture ML model prediction.
     */
    public static final String BACK_GESTURE_ML_MODEL_THRESHOLD = "back_gesture_ml_model_threshold";


    private SystemUiDeviceConfigFlags() {
    private SystemUiDeviceConfigFlags() {
    }
    }
}
}
+11 −0
Original line number Original line Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui;


import android.annotation.NonNull;
import android.annotation.NonNull;
import android.content.Context;
import android.content.Context;
import android.content.res.AssetManager;
import android.content.res.Resources;
import android.content.res.Resources;
import android.os.Handler;
import android.os.Handler;
import android.os.Looper;
import android.os.Looper;
@@ -39,6 +40,7 @@ import com.android.systemui.screenshot.ScreenshotNotificationSmartActionsProvide
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationListener;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.NotificationMediaManager;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.notification.NotificationWakeUpCoordinator;
import com.android.systemui.statusbar.phone.BackGestureTfClassifierProvider;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.DozeParameters;
import com.android.systemui.statusbar.phone.KeyguardBouncer;
import com.android.systemui.statusbar.phone.KeyguardBouncer;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
import com.android.systemui.statusbar.phone.KeyguardBypassController;
@@ -182,4 +184,13 @@ public class SystemUIFactory {
            return mContext;
            return mContext;
        }
        }
    }
    }

    /**
     * Creates an instance of BackGestureTfClassifierProvider.
     * This method is overridden in vendor specific implementation of Sys UI.
     */
    public BackGestureTfClassifierProvider createBackGestureTfClassifierProvider(
            AssetManager am, String modelName) {
        return new BackGestureTfClassifierProvider();
    }
}
}
+1 −1
Original line number Original line Diff line number Diff line
@@ -301,7 +301,7 @@ class ToggleRangeBehavior : Behavior {
    }
    }


    fun findNearestStep(value: Float): Float {
    fun findNearestStep(value: Float): Float {
        var minDiff = 1000f
        var minDiff = Float.MAX_VALUE


        var f = rangeTemplate.getMinValue()
        var f = rangeTemplate.getMinValue()
        while (f <= rangeTemplate.getMaxValue()) {
        while (f <= rangeTemplate.getMaxValue()) {
+66 −0
Original line number Original line Diff line number Diff line
/*
 * Copyright (C) 2020 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.systemui.statusbar.phone;

import android.content.res.AssetManager;

import java.util.HashMap;
import java.util.Map;

/**
 * This class can be overridden by a vendor-specific sys UI implementation,
 * in order to provide classification models for the Back Gesture.
 */
public class BackGestureTfClassifierProvider {
    private static final String TAG = "BackGestureTfClassifierProvider";

    /**
     * Default implementation that returns an empty map.
     * This method is overridden in vendor-specific Sys UI implementation.
     *
     * @param am       An AssetManager to get the vocab file.
    */
    public Map<String, Integer> loadVocab(AssetManager am) {
        return new HashMap<String, Integer>();
    }

    /**
     * This method is overridden in vendor-specific Sys UI implementation.
     *
     * @param featuresVector   List of input features.
     *
    */
    public float predict(Object[] featuresVector) {
        return -1;
    }

    /**
     * Interpreter owns resources. This method releases the resources after
     * use to avoid memory leak.
     * This method is overridden in vendor-specific Sys UI implementation.
     *
     */
    public void release() {}

    /**
     * Returns whether to use the ML model for Back Gesture.
     * This method is overridden in vendor-specific Sys UI implementation.
     *
     */
    public boolean isActive() {
        return false;
    }
}
Loading