Remove swipe up setting page if the feature is not available

Bug: 77974864
Test: Manual test and RoboTests
Change-Id: Ie23a01f254d65e5888f91b5b1cb80df40976c569
This commit is contained in:
Mehdi Alizadeh
2018-04-12 14:08:12 -07:00
parent 031bee8e6e
commit e848603807
2 changed files with 37 additions and 2 deletions

View File

@@ -16,8 +16,11 @@
package com.android.settings.gestures;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.content.pm.PackageManager;
import android.content.res.Resources;
import android.os.UserHandle;
import android.os.UserManager;
@@ -33,6 +36,7 @@ public class SwipeUpPreferenceController extends GesturePreferenceController {
private final int ON = 1;
private final int OFF = 0;
private static final String ACTION_QUICKSTEP = "android.intent.action.QUICKSTEP_SERVICE";
private static final String PREF_KEY_VIDEO = "gesture_swipe_up_video";
private final UserManager mUserManager;
@@ -42,6 +46,14 @@ public class SwipeUpPreferenceController extends GesturePreferenceController {
}
static boolean isGestureAvailable(Context context) {
final ComponentName recentsComponentName = ComponentName.unflattenFromString(
context.getString(com.android.internal.R.string.config_recentsComponentName));
final Intent quickStepIntent = new Intent(ACTION_QUICKSTEP)
.setPackage(recentsComponentName.getPackageName());
if (context.getPackageManager().resolveService(quickStepIntent,
PackageManager.MATCH_SYSTEM_ONLY) == null) {
return false;
}
return true;
}