• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2020 The Android Open Source Project
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *      http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package com.android.systemui.navigationbar.gestural;
17 
18 import android.content.res.AssetManager;
19 
20 import java.util.HashMap;
21 import java.util.Map;
22 
23 /**
24  * This class can be overridden by a vendor-specific sys UI implementation,
25  * in order to provide classification models for the Back Gesture.
26  */
27 public class BackGestureTfClassifierProvider {
28     private static final String TAG = "BackGestureTfClassifierProvider";
29 
30     /**
31      * Default implementation that returns an empty map.
32      * This method is overridden in vendor-specific Sys UI implementation.
33      *
34      * @param am       An AssetManager to get the vocab file.
35     */
loadVocab(AssetManager am)36     public Map<String, Integer> loadVocab(AssetManager am) {
37         return new HashMap<String, Integer>();
38     }
39 
40     /**
41      * This method is overridden in vendor-specific Sys UI implementation.
42      *
43      * @param featuresVector   List of input features.
44      *
45     */
predict(Object[] featuresVector)46     public float predict(Object[] featuresVector) {
47         return -1;
48     }
49 
50     /**
51      * Interpreter owns resources. This method releases the resources after
52      * use to avoid memory leak.
53      * This method is overridden in vendor-specific Sys UI implementation.
54      *
55      */
release()56     public void release() {}
57 
58     /**
59      * Returns whether to use the ML model for Back Gesture.
60      * This method is overridden in vendor-specific Sys UI implementation.
61      *
62      */
isActive()63     public boolean isActive() {
64         return false;
65     }
66 }
67