Add log to capture the hardware status.

Sometimes Settings Search show the items that are not supported by
the hardware. e.g. FaceLock.
Add log to check the HW status when the problem occurred.

Bug: 156667203
Test: watch the log output.
Change-Id: Ie6a89f338aac6f7bdefc69fc84cfa5bf848ed015
This commit is contained in:
Stanley Wang
2020-06-18 16:19:26 +08:00
parent 6217af3fe1
commit f7e6c1e4c5
9 changed files with 40 additions and 22 deletions

View File

@@ -21,6 +21,7 @@ import static android.provider.Settings.Secure.ASSIST_GESTURE_SILENCE_ALERTS_ENA
import android.content.Context;
import android.provider.Settings;
import android.util.Log;
import androidx.annotation.VisibleForTesting;
import androidx.preference.Preference;
@@ -31,6 +32,7 @@ import com.android.settings.overlay.FeatureFactory;
public class AssistGestureSettingsPreferenceController extends GesturePreferenceController {
private static final String TAG = "AssistGesture";
private static final String PREF_KEY_VIDEO = "gesture_assist_video";
private static final String SECURE_KEY_ASSIST = ASSIST_GESTURE_ENABLED;
@@ -55,8 +57,11 @@ public class AssistGestureSettingsPreferenceController extends GesturePreference
@Override
public int getAvailabilityStatus() {
final boolean isAvailable = mAssistOnly ? mFeatureProvider.isSupported(mContext)
: mFeatureProvider.isSensorAvailable(mContext);
final boolean isSupported = mFeatureProvider.isSupported(mContext);
final boolean isSensorAvailable = mFeatureProvider.isSensorAvailable(mContext);
final boolean isAvailable = mAssistOnly ? isSupported : isSensorAvailable;
Log.d(TAG, "mAssistOnly:" + mAssistOnly + ", isSupported:" + isSupported
+ ", isSensorAvailable:" + isSensorAvailable);
return isAvailable ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}