-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Credits to LineageOS and related authors on: https://github.com/LineageOS/android_packages_apps_LineageParts Clean up and rewrite to use PreferenceFragment and other improvements by @SKULSHADY
- Loading branch information
0 parents
commit 5657a13
Showing
13 changed files
with
1,019 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
LOCAL_PATH:= $(call my-dir) | ||
include $(CLEAR_VARS) | ||
|
||
LOCAL_MODULE_TAGS := optional | ||
|
||
LOCAL_SRC_FILES := $(call all-java-files-under, src) | ||
LOCAL_USE_AAPT2 := true | ||
|
||
LOCAL_PACKAGE_NAME := TouchGestures | ||
LOCAL_CERTIFICATE := platform | ||
LOCAL_PRIVILEGED_MODULE := true | ||
LOCAL_PRIVATE_PLATFORM_APIS := true | ||
|
||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags | ||
|
||
include frameworks/base/packages/SettingsLib/common.mk | ||
include vendor/support/common.mk | ||
|
||
include $(BUILD_PACKAGE) | ||
|
||
include $(call all-makefiles-under,$(LOCAL_PATH)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | ||
package="com.android.touch.gestures" | ||
android:sharedUserId="android.uid.system"> | ||
|
||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED" /> | ||
<uses-permission android:name="android.permission.WRITE_SETTINGS" /> | ||
|
||
<protected-broadcast android:name="com.android.touch.gestures.UPDATE_SETTINGS" /> | ||
|
||
<uses-sdk | ||
android:targetSdkVersion="27"/> | ||
|
||
<application | ||
android:label="Touchscreen Gestures" | ||
android:persistent="true" | ||
android:supportsRtl="true"> | ||
|
||
<receiver android:name=".BootReceiver" android:enabled="true"> | ||
<intent-filter android:priority="999999"> | ||
<action android:name="android.intent.action.BOOT_COMPLETED" /> | ||
</intent-filter> | ||
</receiver> | ||
|
||
<activity android:name=".KeyHandler" /> | ||
|
||
<activity | ||
android:name=".TouchscreenGestureSettings" | ||
android:label="@string/touchscreen_gesture_settings_title" | ||
android:theme="@style/AppTheme"> | ||
</activity> | ||
</application> | ||
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
# Keep all Fragments in this package, which are used by reflection. | ||
-keep class com.android.touch.gestures.* | ||
|
||
# Keep keyhandler constructor | ||
-keep public class * implements com.android.internal.os.DeviceKeyHandler { | ||
public <init>(android.content.Context); | ||
} | ||
|
||
-keepclasseswithmembers class * { | ||
public <init>(android.content.Context, android.util.AttributeSet); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (c) 2019 Havoc-OS | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<resources> | ||
|
||
<!-- Gestures - touchscreen gesture actions --> | ||
<string-array name="touchscreen_gesture_action_entries"> | ||
<item>@string/touchscreen_gesture_action_do_nothing</item> | ||
<item>@string/touchscreen_gesture_action_flashlight</item> | ||
<item>@string/touchscreen_gesture_action_camera</item> | ||
<item>@string/touchscreen_gesture_action_browser</item> | ||
<item>@string/touchscreen_gesture_action_dialer</item> | ||
<item>@string/touchscreen_gesture_action_email</item> | ||
<item>@string/touchscreen_gesture_action_messages</item> | ||
<item>@string/touchscreen_gesture_action_play_pause_music</item> | ||
<item>@string/touchscreen_gesture_action_previous_track</item> | ||
<item>@string/touchscreen_gesture_action_next_track</item> | ||
<item>@string/touchscreen_gesture_action_volume_down</item> | ||
<item>@string/touchscreen_gesture_action_volume_up</item> | ||
</string-array> | ||
<string-array name="touchscreen_gesture_action_values"> | ||
<item>0</item> | ||
<item>1</item> | ||
<item>2</item> | ||
<item>3</item> | ||
<item>4</item> | ||
<item>5</item> | ||
<item>6</item> | ||
<item>7</item> | ||
<item>8</item> | ||
<item>9</item> | ||
<item>10</item> | ||
<item>11</item> | ||
</string-array> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (c) 2019 Havoc-OS | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> | ||
|
||
<!-- Default action ids for a device's touchscreen gestures | ||
The array should be sorted in the same order as the | ||
touchscreen gestures advertised by the device's LineageHW impl. --> | ||
<integer-array name="config_defaultTouchscreenGestureActions" /> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (c) 2019 Havoc-OS | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2"> | ||
|
||
<!-- Gestures: Touchscreen gestures --> | ||
<string name="touchscreen_gesture_settings_title">Touchscreen gestures</string> | ||
<string name="touchscreen_gesture_settings_summary">Perform various touchscreen gestures for quick actions</string> | ||
|
||
<string name="touchscreen_gestures_haptic_feedback_title">Haptic feedback</string> | ||
<string name="touchscreen_gestures_haptic_feedback_summary">Vibrate when a touchscreen gesture is detected</string> | ||
|
||
<string name="touchscreen_gesture_two_finger_down_swipe_title">Swipe down with two fingers</string> | ||
<string name="touchscreen_gesture_one_finger_up_swipe_title">Swipe up with one finger</string> | ||
<string name="touchscreen_gesture_one_finger_up_swipe_home_title">Swipe up from the home button</string> | ||
<string name="touchscreen_gesture_one_finger_down_swipe_title">Swipe down with one finger</string> | ||
<string name="touchscreen_gesture_one_finger_left_swipe_title">Swipe left with one finger</string> | ||
<string name="touchscreen_gesture_one_finger_right_swipe_title">Swipe right with one finger</string> | ||
<string name="touchscreen_gesture_up_arrow_title">Draw a \"Λ\"</string> | ||
<string name="touchscreen_gesture_down_arrow_title">Draw a \"V\"</string> | ||
<string name="touchscreen_gesture_left_arrow_title">Draw a \"<\"</string> | ||
<string name="touchscreen_gesture_right_arrow_title">Draw a \">\"</string> | ||
<string name="touchscreen_gesture_letter_c_title">Draw the letter \"C\"</string> | ||
<string name="touchscreen_gesture_letter_e_title">Draw the letter \"e\"</string> | ||
<string name="touchscreen_gesture_letter_o_title">Draw the letter \"O\"</string> | ||
<string name="touchscreen_gesture_letter_m_title">Draw the letter \"M\"</string> | ||
<string name="touchscreen_gesture_letter_s_title">Draw the letter \"S\"</string> | ||
<string name="touchscreen_gesture_letter_v_title">Draw the letter \"V\"</string> | ||
<string name="touchscreen_gesture_letter_w_title">Draw the letter \"W\"</string> | ||
<string name="touchscreen_gesture_letter_z_title">Draw the letter \"Z\"</string> | ||
|
||
<!-- Gesture: Stylus gestures --> | ||
<string name="touchscreen_gesture_swipe_up_stylus_title">Swipe up with the stylus</string> | ||
<string name="touchscreen_gesture_swipe_down_stylus_title">Swipe down with the stylus</string> | ||
<string name="touchscreen_gesture_swipe_left_stylus_title">Swipe left with the stylus</string> | ||
<string name="touchscreen_gesture_swipe_right_stylus_title">Swipe right with the stylus</string> | ||
<string name="touchscreen_gesture_long_press_stylus_title">Long press with the stylus</string> | ||
|
||
<string name="touchscreen_gesture_action_dialog_title">Gesture action</string> | ||
<string name="touchscreen_gesture_action_do_nothing">Do nothing</string> | ||
<string name="touchscreen_gesture_action_flashlight">Toggle flashlight</string> | ||
<string name="touchscreen_gesture_action_camera">Open the camera</string> | ||
<string name="touchscreen_gesture_action_browser">Open the browser</string> | ||
<string name="touchscreen_gesture_action_dialer">Open the dialer</string> | ||
<string name="touchscreen_gesture_action_email">View your emails</string> | ||
<string name="touchscreen_gesture_action_messages">View your messages</string> | ||
<string name="touchscreen_gesture_action_play_pause_music">Play/pause music</string> | ||
<string name="touchscreen_gesture_action_previous_track">Play the previous music track</string> | ||
<string name="touchscreen_gesture_action_next_track">Play the next music track</string> | ||
<string name="touchscreen_gesture_action_volume_down">Lower media volume</string> | ||
<string name="touchscreen_gesture_action_volume_up">Raise media volume</string> | ||
|
||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (c) 2019 Havoc-OS | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<resources> | ||
<style name="AppTheme" parent="@android:style/Theme.DeviceDefault.Settings"> | ||
<item name="android:divider">@null</item> | ||
<item name="android:dividerHeight">0dp</item> | ||
<item name="android:iconSpaceReserved">true</item> | ||
</style> | ||
</resources> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
<?xml version="1.0" encoding="utf-8"?> | ||
<!-- | ||
Copyright (c) 2019 Havoc-OS | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
--> | ||
<PreferenceScreen | ||
xmlns:android="http://schemas.android.com/apk/res/android" | ||
android:key="touchscreen_gesture_settings" | ||
android:title="@string/touchscreen_gesture_settings_title"> | ||
|
||
<com.havoc.support.preferences.SystemSettingSwitchPreference | ||
android:key="touchscreen_gesture_haptic_feedback" | ||
android:title="@string/touchscreen_gestures_haptic_feedback_title" | ||
android:summary="@string/touchscreen_gestures_haptic_feedback_summary" | ||
android:defaultValue="true" /> | ||
|
||
</PreferenceScreen> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
/* | ||
* Copyright (C) 2012 The CyanogenMod Project | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package com.android.touch.gestures; | ||
|
||
import android.content.BroadcastReceiver; | ||
import android.content.Context; | ||
import android.content.Intent; | ||
import android.content.SharedPreferences; | ||
|
||
import androidx.preference.PreferenceManager; | ||
|
||
import com.android.touch.gestures.TouchscreenGestureSettings; | ||
|
||
public class BootReceiver extends BroadcastReceiver { | ||
|
||
private static final String TAG = "BootReceiver"; | ||
private static final String ONE_TIME_TUNABLE_RESTORE = "hardware_tunable_restored"; | ||
|
||
@Override | ||
public void onReceive(Context ctx, Intent intent) { | ||
TouchscreenGestureSettings.MainSettingsFragment.restoreTouchscreenGestureStates(ctx); | ||
} | ||
|
||
private boolean hasRestoredTunable(Context context) { | ||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); | ||
return preferences.getBoolean(ONE_TIME_TUNABLE_RESTORE, false); | ||
} | ||
|
||
private void setRestoredTunable(Context context) { | ||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context); | ||
preferences.edit().putBoolean(ONE_TIME_TUNABLE_RESTORE, true).apply(); | ||
} | ||
} |
Oops, something went wrong.