forked from daproy/android_packages_apps_Settings
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy path0005-add-hot-reboot-dialog-to-show-hide-navbar-setting.patch
80 lines (74 loc) · 3.68 KB
/
0005-add-hot-reboot-dialog-to-show-hide-navbar-setting.patch
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
From 6a0cd3c77dc1057d684c8fc283ff89d0a4bf932b Mon Sep 17 00:00:00 2001
From: Konsta <[email protected]>
Date: Tue, 26 Jun 2012 11:11:17 +0300
Subject: [PATCH 09/16] add hot reboot dialog to show/hide navbar setting
ported from AOKP
Change-Id: I0bec26282eab9ed2113f85b2eb20b2a2d4de1f59
---
res/values/strings.xml | 4 ++++
.../settings/cyanogenmod/SystemSettings.java | 25 ++++++++++++++++++++
2 files changed, 29 insertions(+)
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 62fe6fb..306683f 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -4487,6 +4487,10 @@ found in the list of installed apps.</string>
<!-- Navbar -->
<string name="konsta_navbar">Show navigation bar</string>
<string name="konsta_navbar_reboot">Requires reboot</string>
+ <string name="konsta_navbar_dialog_title">Reboot required</string>
+ <string name="konsta_navbar_dialog_msg">Please reboot to enable/disable the navigation bar</string>
+ <string name="konsta_navbar_dialog_negative">Reboot later</string>
+ <string name="konsta_navbar_dialog_positive">Hot reboot now</string>
<!-- Category for notification light options -->
<string name="notification_light_title">Notification light options</string>
diff --git a/src/com/android/settings/cyanogenmod/SystemSettings.java b/src/com/android/settings/cyanogenmod/SystemSettings.java
index 7301722..d85ecb1 100644
--- a/src/com/android/settings/cyanogenmod/SystemSettings.java
+++ b/src/com/android/settings/cyanogenmod/SystemSettings.java
@@ -17,12 +17,16 @@
package com.android.settings.cyanogenmod;
import android.app.ActivityManagerNative;
+import android.app.AlertDialog;
import android.content.Context;
+import android.content.DialogInterface;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.RemoteException;
import android.os.ServiceManager;
+import android.os.IBinder;
+import android.os.IPowerManager;
import android.preference.CheckBoxPreference;
import android.preference.ListPreference;
import android.preference.Preference;
@@ -167,6 +171,27 @@ public class SystemSettings extends SettingsPreferenceFragment implements
if (preference == mKonstaNavbar) {
Settings.System.putInt(getContentResolver(), Settings.System.KONSTA_NAVBAR,
mKonstaNavbar.isChecked() ? 1 : 0);
+
+ new AlertDialog.Builder(getActivity())
+ .setTitle(getResources().getString(R.string.konsta_navbar_dialog_title))
+ .setMessage(getResources().getString(R.string.konsta_navbar_dialog_msg))
+ .setNegativeButton(getResources().getString(R.string.konsta_navbar_dialog_negative), null)
+ .setCancelable(false)
+ .setPositiveButton(getResources().getString(R.string.konsta_navbar_dialog_positive), new DialogInterface.OnClickListener() {
+ @Override
+ public void onClick(DialogInterface dialog, int which) {
+ try {
+ IBinder b = ServiceManager.getService(Context.POWER_SERVICE);
+ IPowerManager pm = IPowerManager.Stub.asInterface(b);
+ pm.crash("Navbar changed");
+ } catch (android.os.RemoteException e) {
+ //
+ }
+ }
+ })
+ .create()
+ .show();
+
return true;
}
return super.onPreferenceTreeClick(preferenceScreen, preference);
--
1.7.9.5