• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

packages/apps/Settings


Commit MetaInfo

Revisãoc92ac15e06b042383a454669f2b39f33a3a724a2 (tree)
Hora2020-05-20 22:48:00
AutorChih-Wei Huang <cwhuang@linu...>
CommiterChih-Wei Huang

Mensagem de Log

Merge remote-tracking branch 'cm/cm-14.1' into cm-14.1-x86

Mudança Sumário

Diff

--- a/src/com/android/settings/SettingsActivity.java
+++ b/src/com/android/settings/SettingsActivity.java
@@ -536,6 +536,12 @@ public class SettingsActivity extends SettingsDrawerActivity
536536 @Override
537537 protected void onCreate(Bundle savedState) {
538538 super.onCreate(savedState);
539+
540+ if (isLockTaskModePinned() && !isSettingsRunOnTop()) {
541+ Log.w(LOG_TAG, "Devices lock task mode pinned.");
542+ finish();
543+ }
544+
539545 long startTime = System.currentTimeMillis();
540546
541547 // Should happen before any call to getIntent()
@@ -1349,4 +1355,16 @@ public class SettingsActivity extends SettingsDrawerActivity
13491355 }
13501356 super.onActivityResult(requestCode, resultCode, data);
13511357 }
1358+ private boolean isLockTaskModePinned() {
1359+ final ActivityManager activityManager =
1360+ getApplicationContext().getSystemService(ActivityManager.class);
1361+ return activityManager.getLockTaskModeState() == ActivityManager.LOCK_TASK_MODE_PINNED;
1362+ }
1363+ private boolean isSettingsRunOnTop() {
1364+ final ActivityManager activityManager =
1365+ getApplicationContext().getSystemService(ActivityManager.class);
1366+ final String taskPkgName = activityManager.getRunningTasks(1 /* maxNum */)
1367+ .get(0 /* index */).baseActivity.getPackageName();
1368+ return TextUtils.equals(getPackageName(), taskPkgName);
1369+ }
13521370 }