CMActions: add support for screen off gestures
Change-Id: If27b4a2a0ffaeed65df4dfe2d2668ac453105150
This commit is contained in:
@@ -63,6 +63,12 @@
|
||||
android:title="Fingerprint Gestures"
|
||||
android:summary="Use fingerprint gestures" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="fp_home_scr_off"
|
||||
android:dependency="fp_home"
|
||||
android:title="Fingerprint Gestures when screen off"
|
||||
android:summary="Use fingerprint gestures when screen off" />
|
||||
|
||||
<SwitchPreference
|
||||
android:key="fp_haptic"
|
||||
android:dependency="fp_home"
|
||||
@@ -70,6 +76,12 @@
|
||||
android:title="Fingerprint Gestures Haptic Feedback"
|
||||
android:summary="Vibrate on actions" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="fp_keys_scr_on"
|
||||
android:title="Screen On Gestures" >
|
||||
|
||||
<ListPreference
|
||||
android:dependency="fp_home"
|
||||
android:title="Fingerprint Tap"
|
||||
@@ -109,6 +121,51 @@
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/fp_keys_listArray"
|
||||
android:entryValues="@array/fp_keys_listValues" />
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="fp_keys_scr_off"
|
||||
android:title="Screen Off Gestures" >
|
||||
|
||||
<ListPreference
|
||||
android:dependency="fp_home_scr_off"
|
||||
android:title="Fingerprint Tap"
|
||||
android:summary="Select action for single tap"
|
||||
android:dialogTitle="Select action for single tap"
|
||||
android:key="fp_keys_off"
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/fp_keys_listArray"
|
||||
android:entryValues="@array/fp_keys_listValues" />
|
||||
|
||||
<ListPreference
|
||||
android:dependency="fp_home_scr_off"
|
||||
android:title="Fingerprint Long Press"
|
||||
android:summary="Select action for long press"
|
||||
android:dialogTitle="Select action for long press"
|
||||
android:key="fp_key_hold_off"
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/fp_keys_listArray"
|
||||
android:entryValues="@array/fp_keys_listValues" />
|
||||
|
||||
<ListPreference
|
||||
android:dependency="fp_home_scr_off"
|
||||
android:title="Fingerprint Swipe Left"
|
||||
android:summary="Select action for swipe left"
|
||||
android:dialogTitle="Select action for swipe left"
|
||||
android:key="fp_key_left_off"
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/fp_keys_listArray"
|
||||
android:entryValues="@array/fp_keys_listValues" />
|
||||
|
||||
<ListPreference
|
||||
android:dependency="fp_home_scr_off"
|
||||
android:title="Fingerprint Swipe Right"
|
||||
android:summary="Select action for swipe right"
|
||||
android:dialogTitle="Select action for swipe right"
|
||||
android:key="fp_key_right_off"
|
||||
android:defaultValue="0"
|
||||
android:entries="@array/fp_keys_listArray"
|
||||
android:entryValues="@array/fp_keys_listValues" />
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
|
||||
@@ -32,9 +32,11 @@ public class Constants {
|
||||
|
||||
// Swap keys
|
||||
public static final String FP_HOME_KEY = "fp_home";
|
||||
public static final String FP_HOME_KEY_OFF = "fp_home_scr_off";
|
||||
|
||||
// Swap nodes
|
||||
public static final String FP_HOME_NODE = "/sys/homebutton/enable";
|
||||
public static final String FP_HOME_OFF_NODE = "/sys/homebutton/enable_off";
|
||||
|
||||
// Haptic node
|
||||
public static final String FP_HAPTIC_NODE = "/sys/homebutton/haptic";
|
||||
@@ -46,6 +48,11 @@ public class Constants {
|
||||
public static final String FP_KEY_LEFT = "fp_key_left";
|
||||
public static final String FP_KEY_RIGHT = "fp_key_right";
|
||||
|
||||
public static final String FP_KEYS_OFF = "fp_keys_off";
|
||||
public static final String FP_KEY_HOLD_OFF = "fp_key_hold_off";
|
||||
public static final String FP_KEY_LEFT_OFF = "fp_key_left_off";
|
||||
public static final String FP_KEY_RIGHT_OFF = "fp_key_right_off";
|
||||
|
||||
// Keys nodes
|
||||
public static final String FP_KEYS_NODE = "/sys/homebutton/key";
|
||||
public static final String FP_KEY_HOLD_NODE = "/sys/homebutton/key_hold";
|
||||
@@ -60,6 +67,7 @@ public class Constants {
|
||||
|
||||
public static final String[] sButtonPrefKeys = {
|
||||
FP_HOME_KEY,
|
||||
FP_HOME_KEY_OFF,
|
||||
FP_KEYS,
|
||||
FP_KEY_HOLD,
|
||||
FP_KEY_RIGHT,
|
||||
@@ -67,18 +75,36 @@ public class Constants {
|
||||
FP_HAPTIC_KEY,
|
||||
};
|
||||
|
||||
public static final String[] sButtonScreenOffPrefKeys = {
|
||||
FP_KEYS_OFF,
|
||||
FP_KEY_HOLD_OFF,
|
||||
FP_KEY_RIGHT_OFF,
|
||||
FP_KEY_LEFT_OFF,
|
||||
FP_HOME_KEY_OFF,
|
||||
};
|
||||
|
||||
static {
|
||||
sBooleanNodePreferenceMap.put(FP_HOME_KEY, FP_HOME_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_HOME_KEY_OFF, FP_HOME_OFF_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_KEYS, FP_KEYS_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_KEY_HOLD, FP_KEY_HOLD_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_KEY_LEFT, FP_KEY_LEFT_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_KEY_RIGHT, FP_KEY_RIGHT_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_HAPTIC_KEY, FP_HAPTIC_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_KEYS_OFF, FP_KEYS_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_KEY_HOLD_OFF, FP_KEY_HOLD_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_KEY_LEFT_OFF, FP_KEY_LEFT_NODE);
|
||||
sBooleanNodePreferenceMap.put(FP_KEY_RIGHT_OFF, FP_KEY_RIGHT_NODE);
|
||||
sNodeDefaultMap.put(FP_HOME_KEY, false);
|
||||
sNodeDefaultMap.put(FP_HOME_KEY_OFF, false);
|
||||
sNodeDefaultMap.put(FP_KEYS, "0");
|
||||
sNodeDefaultMap.put(FP_KEY_HOLD, "0");
|
||||
sNodeDefaultMap.put(FP_KEY_LEFT, "0");
|
||||
sNodeDefaultMap.put(FP_KEY_RIGHT, "0");
|
||||
sNodeDefaultMap.put(FP_KEYS_OFF, "0");
|
||||
sNodeDefaultMap.put(FP_KEY_HOLD_OFF, "0");
|
||||
sNodeDefaultMap.put(FP_KEY_LEFT_OFF, "0");
|
||||
sNodeDefaultMap.put(FP_KEY_RIGHT_OFF, "0");
|
||||
sNodeDefaultMap.put(FP_HAPTIC_KEY, false);
|
||||
}
|
||||
|
||||
@@ -96,7 +122,8 @@ public class Constants {
|
||||
|
||||
String value = "1";
|
||||
Log.e(TAG, "Write Pref: " + pref);
|
||||
if (!pref.equals(FP_KEYS) && !pref.equals(FP_KEY_HOLD) && !pref.equals(FP_KEY_LEFT) && !pref.equals(FP_KEY_RIGHT))
|
||||
if (!pref.equals(FP_KEYS) && !pref.equals(FP_KEY_HOLD) && !pref.equals(FP_KEY_LEFT) && !pref.equals(FP_KEY_RIGHT) &&
|
||||
!pref.equals(FP_KEYS_OFF) && !pref.equals(FP_KEY_HOLD_OFF) && !pref.equals(FP_KEY_LEFT_OFF) && !pref.equals(FP_KEY_RIGHT_OFF))
|
||||
value = isPreferenceEnabled(context, pref) ? "1" : "0";
|
||||
else
|
||||
value = GetPreference(context, pref);
|
||||
|
||||
@@ -38,8 +38,16 @@ public class ScreenReceiver extends BroadcastReceiver {
|
||||
public void onReceive(Context context, Intent intent) {
|
||||
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
|
||||
mNotifier.screenTurnedOff();
|
||||
|
||||
for (String pref : Constants.sButtonScreenOffPrefKeys) {
|
||||
Constants.writePreference(context, pref);
|
||||
}
|
||||
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
|
||||
mNotifier.screenTurnedOn();
|
||||
|
||||
for (String pref : Constants.sButtonPrefKeys) {
|
||||
Constants.writePreference(context, pref);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,6 +192,7 @@ on boot
|
||||
|
||||
# FPC home button permissions
|
||||
chown system system /sys/homebutton/enable
|
||||
chown system system /sys/homebutton/enable_off
|
||||
chown system system /sys/homebutton/haptic
|
||||
chown system system /sys/homebutton/key
|
||||
chown system system /sys/homebutton/key_hold
|
||||
|
||||
Reference in New Issue
Block a user