|
20 | 20 | import static com.google.android.accessibility.talkback.trainingcommon.TrainingConfig.TrainingId.TRAINING_ID_ON_BOARDING_TALKBACK; |
21 | 21 | import static com.google.android.accessibility.talkback.trainingcommon.TrainingConfig.TrainingId.TRAINING_ID_ON_BOARDING_TALKBACK_WITHOUT_DESCRIBE_IMAGE; |
22 | 22 |
|
| 23 | +import android.app.ActivityManager; |
23 | 24 | import android.app.NotificationManager; |
24 | 25 | import android.app.PendingIntent; |
25 | 26 | import android.content.Context; |
26 | 27 | import android.content.Intent; |
27 | 28 | import android.content.SharedPreferences; |
28 | 29 | import android.content.SharedPreferences.Editor; |
| 30 | +import android.util.Log; |
| 31 | + |
29 | 32 | import androidx.annotation.StringRes; |
30 | 33 | import androidx.annotation.VisibleForTesting; |
31 | 34 | import com.google.android.accessibility.talkback.R; |
@@ -78,7 +81,7 @@ public static boolean hasOnboardingForNewFeaturesBeenShown( |
78 | 81 | */ |
79 | 82 | public static void showOnboardingIfNecessary(Context context) { |
80 | 83 | FormFactorUtils formFactorUtils = FormFactorUtils.getInstance(); |
81 | | - if (formFactorUtils.isAndroidTv() || formFactorUtils.isAndroidWear()) { |
| 84 | + if (formFactorUtils.isAndroidTv() || formFactorUtils.isAndroidWear() || isInLockTaskMode(context)) { |
82 | 85 | return; |
83 | 86 | } |
84 | 87 |
|
@@ -118,6 +121,13 @@ public static void showOnboardingIfNecessary(Context context) { |
118 | 121 | } |
119 | 122 | } |
120 | 123 |
|
| 124 | + /** Typically Kiosk device use Lock Task mode. If enabled assume the device is a Kiosk device */ |
| 125 | + private static boolean isInLockTaskMode(Context context) { |
| 126 | + ActivityManager activityManager = (ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE); |
| 127 | + Log.i("DEBUG", "activityManager.getLockTaskModeState() " + activityManager.getLockTaskModeState()); |
| 128 | + return activityManager.getLockTaskModeState() != ActivityManager.LOCK_TASK_MODE_NONE; |
| 129 | + } |
| 130 | + |
121 | 131 | private static boolean hasOnboardingForMultiFingerGestureSupportBeenShown( |
122 | 132 | SharedPreferences prefs, Context context) { |
123 | 133 | return prefs.getBoolean( |
|
0 commit comments