msm8953-common: Use MotoActions from hardware/motorola
This commit is contained in:
@@ -1,25 +0,0 @@
|
|||||||
LOCAL_PATH:= $(call my-dir)
|
|
||||||
include $(CLEAR_VARS)
|
|
||||||
|
|
||||||
LOCAL_MODULE_TAGS := optional
|
|
||||||
|
|
||||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
|
||||||
|
|
||||||
LOCAL_PACKAGE_NAME := MotoActions
|
|
||||||
LOCAL_PRIVATE_PLATFORM_APIS := true
|
|
||||||
LOCAL_CERTIFICATE := platform
|
|
||||||
LOCAL_PRIVILEGED_MODULE := true
|
|
||||||
LOCAL_USE_AAPT2 := true
|
|
||||||
|
|
||||||
LOCAL_PROGUARD_FLAG_FILES := proguard.flags
|
|
||||||
|
|
||||||
LOCAL_RESOURCE_DIR := \
|
|
||||||
$(LOCAL_PATH)/res \
|
|
||||||
$(TOP)/packages/resources/devicesettings/res \
|
|
||||||
$(TOP)/packages/resources/devicesettings-custom/res
|
|
||||||
|
|
||||||
LOCAL_PROGUARD_ENABLED := disabled
|
|
||||||
|
|
||||||
include frameworks/base/packages/SettingsLib/common.mk
|
|
||||||
|
|
||||||
include $(BUILD_PACKAGE)
|
|
||||||
@@ -1,94 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
package="com.moto.actions"
|
|
||||||
android:sharedUserId="android.uid.system"
|
|
||||||
>
|
|
||||||
|
|
||||||
<original-package android:name="com.cyanogenmod.settings.device" />
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.ACCESS_NOTIFICATION_POLICY" />
|
|
||||||
<uses-permission android:name="android.permission.MODIFY_PHONE_STATE" />
|
|
||||||
<uses-permission android:name="android.permission.RECEIVE_BOOT_COMPLETED"/>
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
|
||||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
|
||||||
<uses-permission android:name="android.permission.USE_FINGERPRINT" />
|
|
||||||
|
|
||||||
<protected-broadcast android:name="com.android.systemui.doze.pulse" />
|
|
||||||
|
|
||||||
<application
|
|
||||||
android:allowBackup="true"
|
|
||||||
android:label="@string/moto_actions_title"
|
|
||||||
android:icon="@drawable/ic_gesture"
|
|
||||||
android:persistent="true">
|
|
||||||
|
|
||||||
<provider
|
|
||||||
android:name=".MotoActionsSearchIndexablesProvider"
|
|
||||||
android:authorities="com.moto.actions"
|
|
||||||
android:multiprocess="false"
|
|
||||||
android:grantUriPermissions="true"
|
|
||||||
android:permission="android.permission.READ_SEARCH_INDEXABLES"
|
|
||||||
android:exported="true">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.content.action.SEARCH_INDEXABLES_PROVIDER" />
|
|
||||||
</intent-filter>
|
|
||||||
</provider>
|
|
||||||
|
|
||||||
<receiver android:name="com.moto.actions.BootCompletedReceiver">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="android.intent.action.BOOT_COMPLETED" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
</intent-filter>
|
|
||||||
</receiver>
|
|
||||||
|
|
||||||
<service android:name="ServiceWrapper" android:permission="ServiceWrapper">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="ServiceWrapper"/>
|
|
||||||
</intent-filter>
|
|
||||||
</service>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".DozeSettingsActivity"
|
|
||||||
android:label="@string/ambient_display_title"
|
|
||||||
android:theme="@style/MotoActions">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.moto.actions.DOZE_SETTINGS" />
|
|
||||||
<category android:name="android.intent.category.DEFAULT" />
|
|
||||||
</intent-filter>
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".ActionsPreferenceActivity"
|
|
||||||
android:label="@string/moto_actions_title"
|
|
||||||
android:summary="@string/device_gestures_summary"
|
|
||||||
android:theme="@style/MotoActions">
|
|
||||||
<intent-filter>
|
|
||||||
<action android:name="com.android.settings.action.IA_SETTINGS" />
|
|
||||||
</intent-filter>
|
|
||||||
<meta-data
|
|
||||||
android:name="com.android.settings.category"
|
|
||||||
android:value="com.android.settings.category.ia.homepage" />
|
|
||||||
<meta-data
|
|
||||||
android:name="com.android.settings.icon"
|
|
||||||
android:resource="@drawable/ic_settings_gestures_dashboard" />
|
|
||||||
<meta-data
|
|
||||||
android:name="com.android.settings.summary"
|
|
||||||
android:resource="@string/device_gestures_summary" />
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".GestureSettingsActivity"
|
|
||||||
android:label="@string/device_gestures_title"
|
|
||||||
android:theme="@style/MotoActions"
|
|
||||||
android:exported="true">
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
<activity
|
|
||||||
android:name=".FPGestureSettingsActivity"
|
|
||||||
android:label="@string/fingerprint_gestures_title"
|
|
||||||
android:theme="@style/MotoActions"
|
|
||||||
android:exported="true">
|
|
||||||
</activity>
|
|
||||||
|
|
||||||
</application>
|
|
||||||
|
|
||||||
</manifest>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 97 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 18 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 37 KiB |
@@ -1,6 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:aapt="http://schemas.android.com/aapt" android:name="vector" android:tint="?android:attr/colorControlNormal" android:height="1600dp" android:width="1600dp" android:viewportWidth="1600" android:viewportHeight="1600">
|
|
||||||
<group android:name="group">
|
|
||||||
<path android:name="path" android:fillColor="#000" android:pathData="M 980 1360 C 929 1314 921 1310 872 1310 C 803 1310 765 1290 750 1245 C 743 1225 741 1203 743 1196 C 747 1186 736 1180 705 1175 C 649 1167 620 1134 620 1079 C 620 1040 620 1040 581 1040 C 523 1040 486 1006 486 951 C 485 911 484 910 452 910 C 411 910 364 887 350 860 C 338 837 343 711 357 687 C 381 645 645 371 667 365 C 706 356 730 368 806 437 L 878 501 L 888 471 C 904 426 935 400 974 400 C 1005 400 1029 419 1198 575 C 1428 788 1425 784 1424 960 C 1423 1062 1419 1094 1403 1131 C 1376 1192 1326 1247 1271 1275 C 1246 1288 1200 1323 1170 1354 C 1122 1404 1111 1410 1075 1410 C 1041 1409 1026 1401 980 1360 Z M 1202 1238 C 1257 1222 1325 1159 1346 1105 C 1370 1040 1372 857 1348 813 C 1332 784 1001 470 977 461 C 964 456 940 488 940 511 C 940 520 962 562 989 603 C 1045 688 1047 694 1037 731 C 1025 778 996 782 694 779 C 439 775 417 776 406 793 C 398 805 398 815 406 828 C 416 843 442 845 679 848 L 940 850 L 940 910 L 751 910 C 591 910 560 912 549 926 C 540 937 539 946 547 958 C 556 973 584 976 746 980 L 935 985 L 938 1013 L 941 1040 L 823 1040 C 758 1040 699 1044 692 1049 C 684 1053 680 1068 682 1081 C 684 1101 693 1106 730 1112 C 755 1115 812 1119 858 1119 L 941 1120 L 938 1148 C 935 1174 932 1175 874 1178 C 809 1181 791 1197 812 1234 C 820 1248 844 1250 992 1250 C 1094 1250 1178 1245 1202 1238 Z M 660 670 C 690 640 673 605 629 605 C 599 605 595 608 592 635 C 589 654 594 668 606 677 C 630 694 637 693 660 670 Z M 198 729 C 156 705 169 566 225 454 C 286 329 415 232 551 208 C 601 199 614 200 635 214 C 662 232 669 271 648 288 C 641 293 613 301 585 304 C 438 325 309 452 281 601 C 276 632 274 667 277 678 C 280 691 274 706 261 719 C 238 742 224 744 198 729 Z" android:strokeWidth="1"/>
|
|
||||||
</group>
|
|
||||||
</vector>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:aapt="http://schemas.android.com/aapt" android:name="vector" android:tint="?android:attr/colorControlNormal" android:height="1600dp" android:width="1600dp" android:viewportWidth="1600" android:viewportHeight="1600">
|
|
||||||
<group android:name="group">
|
|
||||||
<path android:name="path" android:fillColor="#000" android:pathData="M 287 1283 C 273 1270 280 1223 298 1207 C 315 1192 365 1190 808 1190 L 1300 1190 L 1316 1214 C 1324 1228 1330 1249 1328 1262 L 1325 1285 L 809 1288 C 526 1289 290 1287 287 1283 Z M 382 1008 C 261 895 234 858 219 794 C 209 752 210 734 224 686 C 239 635 253 616 329 539 C 427 440 463 420 547 420 C 654 420 682 441 976 732 C 1189 944 1240 1000 1240 1021 C 1240 1094 1139 1125 1057 1077 C 1033 1063 1008 1044 1000 1036 C 983 1014 970 1016 970 1040 C 970 1082 939 1097 851 1097 C 755 1097 731 1084 705 1016 C 688 973 692 919 715 857 C 721 842 714 840 636 840 C 584 840 550 844 550 850 C 550 856 561 883 575 910 C 611 980 606 1034 560 1080 C 519 1121 488 1108 382 1008 Z M 532 1016 C 541 995 538 979 510 916 C 481 851 478 837 488 815 C 505 779 537 770 653 770 C 805 770 812 773 966 916 C 1084 1026 1104 1040 1135 1040 C 1157 1040 1170 1035 1170 1027 C 1170 1020 1059 903 923 768 C 663 510 626 481 547 480 C 488 480 448 504 366 590 C 280 681 262 723 281 793 C 290 827 312 854 398 937 C 457 994 508 1040 513 1040 C 517 1040 525 1029 532 1016 Z M 781 955 L 774 885 L 762 926 C 750 967 753 992 773 1018 C 788 1036 788 1032 781 955 Z M 910 987 C 910 953 904 938 882 917 C 867 902 851 890 847 890 C 843 890 840 911 840 938 C 840 991 861 1030 891 1030 C 907 1030 910 1023 910 987 Z" android:strokeWidth="1"/>
|
|
||||||
<path android:name="path_1" android:fillColor="#000" android:pathData="M 1284 1086 C 1268 1074 1264 1054 1259 933 C 1254 830 1247 780 1232 737 C 1180 593 1093 488 986 440 C 917 408 902 385 923 340 C 958 266 1133 346 1236 483 C 1339 620 1379 738 1387 926 C 1393 1051 1392 1058 1371 1079 C 1347 1103 1312 1106 1284 1086 Z" android:strokeWidth="1"/>
|
|
||||||
</group>
|
|
||||||
</vector>
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:aapt="http://schemas.android.com/aapt" android:name="vector" android:tint="?android:attr/colorControlNormal" android:height="1610dp" android:width="1610dp" android:viewportWidth="1610" android:viewportHeight="1610">
|
|
||||||
<group android:name="group">
|
|
||||||
<path android:name="path" android:fillColor="#000" android:pathData="M 592 1464 C 571 1450 570 1442 570 1311 C 570 1190 572 1171 588 1157 C 612 1135 633 1136 653 1158 C 667 1173 670 1200 670 1313 C 670 1442 669 1450 648 1464 C 636 1473 623 1480 620 1480 C 617 1480 604 1473 592 1464 Z M 720 1460 C 704 1444 700 1427 700 1377 C 700 1298 713 1277 760 1282 L 795 1285 L 798 1373 C 801 1459 800 1460 775 1470 C 741 1483 743 1483 720 1460 Z" android:strokeWidth="1"/>
|
|
||||||
<path android:name="path_1" android:fillColor="#000" android:pathData="M 1073 1437 C 1027 1394 1022 1392 946 1385 C 850 1376 820 1354 820 1292 C 820 1254 819 1252 782 1246 C 729 1238 695 1200 695 1149 C 695 1111 694 1110 662 1110 C 612 1110 570 1064 570 1011 L 570 970 L 529 970 C 497 970 482 964 458 940 C 426 907 426 913 448 782 C 456 730 461 724 605 580 C 700 485 764 429 781 425 C 818 417 854 437 920 504 C 976 561 990 570 990 547 C 990 529 1029 494 1058 485 C 1093 475 1137 510 1318 694 C 1442 820 1481 866 1490 897 C 1498 922 1501 982 1498 1061 C 1495 1171 1491 1191 1468 1236 C 1436 1296 1383 1345 1321 1373 C 1295 1383 1257 1410 1234 1431 C 1208 1457 1181 1473 1158 1477 C 1125 1482 1117 1478 1073 1437 Z M 1309 1310 C 1362 1284 1416 1218 1429 1165 C 1445 1100 1443 935 1426 902 C 1418 887 1337 801 1246 710 C 1104 569 1077 547 1062 556 C 1030 576 1037 614 1084 693 C 1135 776 1140 810 1109 841 C 1088 862 1081 863 961 857 C 892 853 760 847 669 844 L 502 837 L 495 860 C 481 904 499 908 765 920 C 903 927 1019 935 1024 940 C 1028 944 1027 956 1022 967 C 1012 983 996 985 823 985 L 635 985 L 632 1013 C 630 1028 630 1041 632 1041 C 634 1042 721 1048 825 1054 L 1015 1065 L 1015 1115 L 892 1115 C 794 1115 767 1118 760 1130 C 748 1149 748 1151 760 1170 C 767 1181 797 1186 887 1190 C 1005 1195 1005 1195 1005 1220 C 1005 1243 1001 1245 945 1250 C 886 1255 885 1256 885 1285 C 885 1311 889 1316 920 1321 C 939 1325 1026 1328 1113 1329 C 1252 1330 1275 1328 1309 1310 Z M 440 1451 C 434 1439 430 1354 430 1245 C 430 1136 434 1051 440 1039 C 452 1017 499 1013 518 1032 C 535 1049 535 1441 518 1458 C 499 1477 452 1473 440 1451 Z M 300 582 C 269 557 282 540 330 540 C 378 540 391 557 360 582 C 348 592 334 600 330 600 C 326 600 312 592 300 582 Z" android:strokeWidth="1"/>
|
|
||||||
<path android:name="path_2" android:fillColor="#000" android:pathData="M 485 550 C 468 532 454 530 308 530 C 174 530 148 528 143 514 C 140 505 148 488 163 472 C 185 448 188 434 192 348 C 197 256 196 250 174 229 C 146 203 143 182 166 173 C 177 169 223 208 322 306 C 510 493 546 536 530 555 C 514 575 507 574 485 550 Z M 356 314 L 267 219 L 287 182 C 309 139 349 131 364 166 C 369 177 386 194 401 203 C 449 230 471 276 468 344 C 466 377 460 405 455 407 C 449 409 404 367 356 314 Z" android:strokeWidth="1"/>
|
|
||||||
</group>
|
|
||||||
</vector>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:aapt="http://schemas.android.com/aapt" android:name="vector" android:tint="?android:attr/colorControlNormal" android:height="1600dp" android:width="1600dp" android:viewportWidth="1600" android:viewportHeight="1600">
|
|
||||||
<group android:name="group">
|
|
||||||
<path android:name="path" android:fillColor="#000" android:pathData="M 375 1429 C 345 1401 295 1366 263 1350 C 193 1317 139 1262 108 1195 C 88 1151 86 1128 85 1015 C 85 906 88 879 104 846 C 117 821 194 742 318 629 C 492 470 517 450 548 450 C 573 450 589 458 611 481 C 627 498 640 518 640 526 C 640 550 652 542 718 478 C 776 420 784 415 825 415 C 869 415 871 416 1025 570 C 1110 655 1180 732 1180 740 C 1180 749 1191 771 1204 789 C 1236 832 1244 869 1230 906 C 1213 951 1180 980 1138 986 C 1102 992 1100 995 1100 1027 C 1100 1072 1049 1125 997 1135 C 965 1141 960 1146 960 1170 C 960 1209 917 1257 870 1271 C 838 1281 831 1288 826 1316 C 822 1336 806 1361 783 1380 C 749 1410 744 1412 675 1409 C 603 1406 602 1406 561 1443 C 526 1474 513 1480 474 1480 C 433 1480 423 1475 375 1429 Z M 541 1374 C 555 1361 558 1348 553 1311 C 548 1268 551 1260 580 1227 C 598 1206 628 1185 651 1179 C 683 1169 690 1162 690 1142 C 690 1105 759 1040 799 1040 C 827 1040 830 1037 830 1009 C 830 986 840 967 869 939 C 904 903 912 900 961 900 C 1009 900 1018 896 1052 863 C 1073 843 1090 821 1090 815 C 1090 810 1020 735 935 650 L 780 495 L 495 780 C 338 937 210 1069 210 1075 C 210 1084 510 1390 519 1390 C 521 1390 531 1383 541 1374 Z M 728 1293 C 731 1272 727 1270 691 1270 C 649 1270 634 1281 644 1306 C 648 1317 661 1320 687 1318 C 718 1316 726 1311 728 1293 Z M 864 1169 C 869 1165 870 1154 866 1145 C 857 1121 786 1128 782 1154 C 780 1164 784 1176 791 1181 C 806 1190 849 1183 864 1169 Z M 1004 1030 C 1022 1012 1001 990 965 990 C 928 990 913 1007 924 1036 C 929 1048 938 1050 962 1045 C 980 1041 999 1034 1004 1030 Z M 539 634 C 564 594 571 574 566 554 C 562 540 553 530 545 532 C 538 534 457 603 367 685 C 181 853 160 883 160 976 L 160 1035 L 333 862 C 429 766 521 664 539 634 Z M 1140 885 C 1161 860 1141 854 1118 878 C 1100 896 1099 900 1112 900 C 1120 900 1133 893 1140 885 Z M 1385 753 C 1332 740 1312 679 1350 645 C 1364 632 1379 629 1405 633 L 1440 639 L 1426 612 C 1382 527 1255 384 1155 309 C 1089 259 1078 230 1111 194 C 1123 181 1141 170 1151 170 C 1194 170 1412 371 1488 483 C 1554 578 1576 661 1550 711 C 1528 750 1454 770 1385 753 Z" android:strokeWidth="1"/>
|
|
||||||
<path android:name="path_1" android:fillColor="#000" android:pathData="M 1180 633 C 1166 624 1120 587 1077 551 C 928 427 830 277 830 175 C 830 128 834 119 861 96 C 878 82 904 70 919 70 C 956 70 1030 109 1054 143 L 1074 170 L 1053 198 C 1037 219 1025 225 997 224 L 961 223 L 980 260 C 1012 323 1089 409 1169 471 C 1286 563 1290 567 1290 593 C 1290 644 1228 666 1180 633 Z" android:strokeWidth="1"/>
|
|
||||||
</group>
|
|
||||||
</vector>
|
|
||||||
@@ -1,7 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:settings="http://schemas.android.com/apk/res/com.android.settings" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:aapt="http://schemas.android.com/aapt" android:name="vector" android:tint="?android:attr/colorControlNormal" android:height="1610dp" android:width="1610dp" android:viewportWidth="1610" android:viewportHeight="1610">
|
|
||||||
<group android:name="group">
|
|
||||||
<path android:name="path" android:fillColor="#000" android:pathData="M 977 1350 C 956 1344 926 1333 910 1325 C 894 1317 870 1310 856 1310 C 798 1310 750 1264 750 1208 C 750 1193 711 1146 625 1060 C 512 946 500 930 500 898 C 500 878 509 852 520 837 C 546 804 546 799 509 764 C 445 704 433 642 475 592 C 497 566 498 559 489 531 C 468 471 512 410 577 410 C 595 410 610 405 610 400 C 610 394 621 378 635 365 C 653 346 670 340 704 340 C 740 340 750 336 755 320 C 758 309 773 291 787 280 C 811 261 827 260 1027 260 L 1242 260 L 1271 289 C 1299 317 1300 323 1300 404 C 1300 489 1300 490 1325 490 C 1339 490 1358 498 1368 508 C 1388 528 1391 561 1406 907 C 1414 1085 1405 1121 1340 1185 C 1318 1207 1300 1229 1300 1236 C 1300 1262 1261 1293 1192 1321 C 1110 1353 1034 1364 977 1350 Z M 1150 1269 C 1202 1243 1297 1154 1326 1104 L 1352 1059 L 1341 827 C 1335 699 1330 585 1330 573 C 1330 545 1301 542 1272 568 C 1257 580 1246 610 1234 670 C 1214 776 1200 800 1158 800 C 1129 800 1102 776 924 599 C 760 436 718 399 699 402 C 683 404 674 413 672 429 C 669 449 701 485 846 631 C 999 785 1022 811 1011 824 C 1003 833 993 840 987 840 C 981 840 892 756 789 654 C 638 504 598 469 579 472 C 562 474 554 482 552 500 C 550 521 582 557 735 710 C 837 812 920 900 920 906 C 920 912 913 923 905 930 C 891 941 866 920 726 782 C 637 693 557 620 549 620 C 530 620 510 640 510 659 C 510 668 583 748 672 837 C 811 977 832 1001 821 1014 C 813 1023 802 1030 796 1030 C 790 1030 746 992 700 945 C 632 877 610 860 590 862 C 572 864 564 872 561 890 C 559 911 586 942 731 1083 C 827 1176 919 1259 935 1268 C 1000 1302 1084 1303 1150 1269 Z M 1170 683 C 1191 576 1200 554 1230 525 C 1257 499 1260 490 1260 433 L 1260 370 L 1030 370 C 854 370 800 373 800 382 C 800 395 1139 740 1152 740 C 1155 740 1164 714 1170 683 Z M 407 1243 C 403 1240 400 1223 400 1206 C 400 1181 412 1162 458 1117 C 516 1059 552 1046 578 1072 C 603 1097 590 1131 533 1191 C 488 1239 471 1250 445 1250 C 428 1250 410 1247 407 1243 Z M 317 1142 C 307 1132 300 1115 300 1104 C 300 1078 420 960 446 960 C 475 960 490 979 490 1015 C 490 1041 479 1058 431 1103 C 368 1163 343 1171 317 1142 Z" android:strokeWidth="1"/>
|
|
||||||
<path android:name="path_1" android:fillColor="#000" android:pathData="M 217 1042 C 207 1032 200 1015 200 1005 C 200 995 246 941 302 884 C 390 794 408 780 437 780 C 473 780 495 807 485 839 C 476 868 275 1060 253 1060 C 242 1060 226 1052 217 1042 Z" android:strokeWidth="1"/>
|
|
||||||
</group>
|
|
||||||
</vector>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) google/material-design-icons
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:height="24dp"
|
|
||||||
android:width="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?android:attr/colorControlNormal" >
|
|
||||||
<path android:fillColor="#000" android:pathData="M 10,9C 10,8.4477 10.4477,8 11,8C 11.5523,8 12,8.4477 12,9L 12,13.47L 13.21,13.6L 18.15,15.79C 18.6759,16.0317 19.0093,16.5613 19,17.14L 19,21.5C 18.974,22.3174 18.3174,22.974 17.5,23L 11,23C 10.6216,23.0009 10.2596,22.8453 10,22.57L 5.1,18.37L 5.84,17.6C 6.03083,17.3942 6.29936,17.2781 6.58,17.28L 6.8,17.28L 10,19L 10,9 Z M 11,5C 13.2091,5 15,6.79086 15,9C 15,10.4806 14.1956,11.7733 13,12.4649L 13,11.2361C 13.6137,10.6868 14,9.8885 14,9.00001C 14,7.34315 12.6568,6.00001 11,6.00001C 9.34314,6.00001 8,7.34315 8,9.00001C 8,9.88851 8.38625,10.6868 9,11.2361L 9,12.4649C 7.8044,11.7733 7,10.4806 7,9C 7,6.79086 8.79086,5 11,5 Z M 11,3C 14.3137,3 17,5.6863 17,9C 17,10.6993 16.2936,12.2336 15.1584,13.3253L 14.1554,12.8788C 15.2811,11.9619 16,10.5649 16,9C 16,6.23858 13.7614,4.00001 11,4.00001C 8.23857,4.00001 6,6.23858 6,9C 6,11.0503 7.23409,12.8124 9,13.584L 9,14.6586C 6.66961,13.8349 5,11.6124 5,9C 5,5.6863 7.68629,3 11,3 Z " />
|
|
||||||
</vector>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) google/material-design-icons
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:height="24dp"
|
|
||||||
android:width="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?android:attr/colorControlNormal" >
|
|
||||||
<path android:fillColor="#000" android:pathData="M 17.8075,4.4675C 17.73,4.4675 17.6513,4.4488 17.5787,4.4088C 15.6587,3.4175 13.9987,2.9978 12.0113,2.9978C 10.0288,2.9978 8.15,3.4713 6.44,4.4088C 6.20125,4.5413 5.89875,4.4488 5.76125,4.2087C 5.63,3.9695 5.7175,3.6625 5.9625,3.53C 7.8225,2.5205 9.85875,2.0025 12.0113,2.0025C 14.1412,2.0025 16.0012,2.4713 18.0425,3.52C 18.2913,3.6521 18.3788,3.95 18.2525,4.19C 18.1588,4.37 17.9887,4.4675 17.8075,4.4675 Z M 3.50125,9.7212C 3.39875,9.7212 3.30125,9.6925 3.2075,9.6287C 2.97875,9.4675 2.93,9.16 3.09125,8.9312C 4.0825,7.5287 5.34125,6.4313 6.84125,5.6588C 9.98,4.0375 13.9987,4.0287 17.1488,5.65C 18.6525,6.4212 19.9125,7.51 20.8984,8.9012C 21.06,9.1213 21.0107,9.4388 20.7813,9.6C 20.5518,9.7612 20.2393,9.7125 20.0787,9.4825C 19.18,8.2175 18.0425,7.2312 16.69,6.5375C 13.8188,5.0687 10.1512,5.0687 7.29,6.5475C 5.9275,7.2512 4.79,8.2525 3.89125,9.5112C 3.80875,9.6488 3.6625,9.7212 3.50125,9.7212 Z M 9.75125,21.7925C 9.61875,21.7925 9.4925,21.7388 9.4,21.64C 8.53,20.7712 8.06125,20.21 7.3875,18.9988C 6.69875,17.7687 6.3375,16.27 6.3375,14.6588C 6.3375,11.69 8.88125,9.2675 12.0025,9.2675C 15.1225,9.2675 17.6612,11.69 17.6612,14.6588C 17.6612,14.9412 17.4413,15.1613 17.1587,15.1613C 16.88,15.1613 16.66,14.9412 16.66,14.6588C 16.66,12.2413 14.57,10.2688 12.0025,10.2688C 9.42875,10.2688 7.33875,12.2413 7.33875,14.6588C 7.33875,16.0988 7.66125,17.4313 8.27125,18.5113C 8.91125,19.6588 9.35,20.1512 10.1225,20.9275C 10.3075,21.1275 10.3075,21.44 10.1225,21.64C 10.01,21.7388 9.8775,21.7925 9.75125,21.7925 Z M 16.9188,19.9412C 15.7325,19.9412 14.6775,19.6388 13.8188,19.0475C 12.3287,18.0425 11.44,16.4012 11.44,14.6588C 11.44,14.38 11.66,14.16 11.9388,14.16C 12.2212,14.16 12.4413,14.38 12.4413,14.6588C 12.4413,16.0687 13.1587,17.4025 14.38,18.2175C 15.0875,18.7013 15.9175,18.9312 16.9188,18.9312C 17.1587,18.9312 17.5587,18.9012 17.9587,18.8275C 18.2325,18.7787 18.4912,18.96 18.54,19.2388C 18.5888,19.5112 18.4087,19.77 18.13,19.8187C 17.5587,19.9313 17.06,19.9412 16.9188,19.9412 Z M 14.9125,22.0025C 14.8688,22.0025 14.8187,21.9925 14.78,21.9825C 13.1888,21.5375 12.1488,20.9525 11.06,19.8775C 9.65875,18.4913 8.89125,16.64 8.89125,14.6588C 8.89125,13.0425 10.2688,11.7188 11.9675,11.7188C 13.6725,11.7188 15.0487,13.0425 15.0487,14.6588C 15.0487,15.7325 15.9813,16.6013 17.1288,16.6013C 18.2813,16.6013 19.2087,15.7325 19.2087,14.6588C 19.2087,10.8887 15.9625,7.8325 11.9575,7.8325C 9.12125,7.8325 6.51875,9.4087 5.35125,11.86C 4.96125,12.6713 4.76125,13.6187 4.76125,14.6588C 4.76125,15.44 4.82875,16.67 5.43,18.2712C 5.5325,18.53 5.4,18.8188 5.14125,18.9113C 4.8775,19.0087 4.59,18.8725 4.5025,18.6187C 4.00875,17.31 3.77,16.0113 3.77,14.6588C 3.77,13.4625 3.99875,12.3687 4.44875,11.4213C 5.78125,8.6275 8.73,6.8212 11.9575,6.8212C 16.5088,6.8212 20.21,10.3325 20.21,14.6487C 20.21,16.27 18.8287,17.5875 17.1288,17.5875C 15.43,17.5875 14.0475,16.27 14.0475,14.6487C 14.0475,13.5788 13.12,12.71 11.9675,12.71C 10.82,12.71 9.8875,13.5788 9.8875,14.6487C 9.8875,16.3625 10.5513,17.9587 11.7575,19.16C 12.71,20.0975 13.6188,20.62 15.0288,21.0113C 15.2975,21.0788 15.4488,21.3625 15.3813,21.6213C 15.3325,21.85 15.1225,22.0025 14.9125,22.0025 Z " />
|
|
||||||
</vector>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 7.5 KiB |
@@ -1,9 +0,0 @@
|
|||||||
<!-- drawable/ic_hand.xml -->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:height="24dp"
|
|
||||||
android:width="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?android:attr/colorControlNormal" >
|
|
||||||
<path android:fillColor="#000" android:pathData="M6.58,19H14.58V22H6.58V19M19.74,11.6C19.55,11.4 19.29,11.28 19,11.28L18.78,11.31L15.58,13V11.83L16.09,2.9C16.12,2.35 15.7,1.87 15.15,1.84C14.6,1.81 14.12,2.23 14.09,2.78L13.82,7.47H13.58L12.54,7.58V2A1,1 0 0,0 11.54,1C11,1 10.54,1.45 10.54,2V8.41L9.72,8.78L9.03,3.32C8.96,2.77 8.46,2.38 7.91,2.45C7.36,2.5 6.97,3 7.04,3.57L7.81,9.63L7.43,9.8C7.3,9.85 7.18,9.93 7.07,10L5.97,6.11C5.81,5.54 5.25,5.2 4.71,5.34C4.18,5.5 3.88,6.08 4.04,6.65L6.61,15.77C6.61,15.8 6.63,15.84 6.64,15.87L6.67,16H6.68C6.9,16.57 7.47,17 8.08,17H14.58C14.97,17 15.32,16.84 15.58,16.57L20.5,12.37L19.74,11.6Z" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<!-- drawable/ic_pickup.xml -->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:height="24dp"
|
|
||||||
android:width="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?android:attr/colorControlNormal" >
|
|
||||||
<path android:fillColor="#000" android:pathData="M9.64,13.4C8.63,12.5 7.34,12.03 6,12V15L2,11L6,7V10C7.67,10 9.3,10.57 10.63,11.59C10.22,12.15 9.89,12.76 9.64,13.4M18,15V12C17.5,12 13.5,12.16 13.05,16.2C14.61,16.75 15.43,18.47 14.88,20.03C14.33,21.59 12.61,22.41 11.05,21.86C9.5,21.3 8.67,19.59 9.22,18.03C9.5,17.17 10.2,16.5 11.05,16.2C11.34,12.61 14.4,9.88 18,10V7L22,11L18,15M13,19A1,1 0 0,0 12,18A1,1 0 0,0 11,19A1,1 0 0,0 12,20A1,1 0 0,0 13,19M11,11.12C11.58,10.46 12.25,9.89 13,9.43V5H16L12,1L8,5H11V11.12Z" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="1000.000000"
|
|
||||||
android:viewportHeight="1000.000000"
|
|
||||||
android:tint="?android:attr/colorControlNormal">
|
|
||||||
|
|
||||||
<group
|
|
||||||
android:translateY="1000.000000"
|
|
||||||
android:scaleX="0.100000"
|
|
||||||
android:scaleY="-0.100000">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:strokeWidth="1"
|
|
||||||
android:pathData="M3022 9600 c-109 -29 -187 -74 -272 -160 -87 -86 -131 -163 -160 -276 -20 -76 -20
|
|
||||||
-127 -20 -4094 0 -3967 0 -4018 20 -4094 29 -113 73 -190 160 -276 86 -87 163 -131
|
|
||||||
276 -160 75 -20 117 -20 1849 -20 1732 0 1774 0 1849 20 113 29 190 73 276 160 87
|
|
||||||
86 131 163 160 276 20 76 20 127 20 4094 0 3967 0 4018 -20 4094 -29 113 -73 190
|
|
||||||
-160 276 -86 87 -163 131 -276 160 -75 20 -116 20 -1853 19 -1716 0 -1778 -1 -1849
|
|
||||||
-19z m1943 -2149 c51 -23 93 -65 116 -116 14 -31 19 -65 19 -150 l0 -110 83 -19
|
|
||||||
c227 -50 446 -169 623 -338 195 -187 315 -391 387 -658 l32 -115 3 -785 2 -785 363
|
|
||||||
-357 362 -357 -2075 0 -2075 0 352 347 352 347 3 795 3 795 32 115 c72 267 192 471
|
|
||||||
387 658 177 169 396 288 624 338 l82 19 0 110 c0 85 5 119 19 150 38 84 117 135
|
|
||||||
211 135 32 0 72 -8 95 -19z m415 -4018 c-1 -27 -32 -118 -60 -172 -60 -119 -188
|
|
||||||
-221 -325 -257 -27 -8 -86 -14 -130 -14 -95 0 -157 15 -244 60 -119 60 -221 188
|
|
||||||
-257 325 -8 28 -14 53 -14 58 0 4 232 7 515 7 283 0 515 -3 515 -7z" />
|
|
||||||
</group>
|
|
||||||
</vector>
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:height="24dp"
|
|
||||||
android:width="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?android:attr/colorControlNormal">
|
|
||||||
<path android:fillColor="#FFFFFFFF" android:pathData="M11.83,1.73C8.43,1.79 6.23,3.32 6.23,3.32C5.95,3.5 5.88,3.91 6.07,4.19C6.27,4.5 6.66,4.55 6.96,4.34C6.96,4.34 11.27,1.15 17.46,4.38C17.75,4.55 18.14,4.45 18.31,4.15C18.5,3.85 18.37,3.47 18.03,3.28C16.36,2.4 14.78,1.96 13.36,1.8C12.83,1.74 12.32,1.72 11.83,1.73M12.22,4.34C6.26,4.26 3.41,9.05 3.41,9.05C3.22,9.34 3.3,9.72 3.58,9.91C3.87,10.1 4.26,10 4.5,9.68C4.5,9.68 6.92,5.5 12.2,5.59C17.5,5.66 19.82,9.65 19.82,9.65C20,9.94 20.38,10.04 20.68,9.87C21,9.69 21.07,9.31 20.9,9C20.9,9 18.15,4.42 12.22,4.34M11.5,6.82C9.82,6.94 8.21,7.55 7,8.56C4.62,10.53 3.1,14.14 4.77,19C4.88,19.33 5.24,19.5 5.57,19.39C5.89,19.28 6.07,18.92 5.95,18.6V18.6C4.41,14.13 5.78,11.2 7.8,9.5C9.77,7.89 13.25,7.5 15.84,9.1C17.11,9.9 18.1,11.28 18.6,12.64C19.11,14 19.08,15.32 18.67,15.94C18.25,16.59 17.4,16.83 16.65,16.64C15.9,16.45 15.29,15.91 15.26,14.77C15.23,13.06 13.89,12 12.5,11.84C11.16,11.68 9.61,12.4 9.21,14C8.45,16.92 10.36,21.07 14.78,22.45C15.11,22.55 15.46,22.37 15.57,22.04C15.67,21.71 15.5,21.35 15.15,21.25C11.32,20.06 9.87,16.43 10.42,14.29C10.66,13.33 11.5,13 12.38,13.08C13.25,13.18 14,13.7 14,14.79C14.05,16.43 15.12,17.54 16.34,17.85C17.56,18.16 18.97,17.77 19.72,16.62C20.5,15.45 20.37,13.8 19.78,12.21C19.18,10.61 18.07,9.03 16.5,8.04C14.96,7.08 13.19,6.7 11.5,6.82M11.86,9.25V9.26C10.08,9.32 8.3,10.24 7.28,12.18C5.96,14.67 6.56,17.21 7.44,19.04C8.33,20.88 9.54,22.1 9.54,22.1C9.78,22.35 10.17,22.35 10.42,22.11C10.67,21.87 10.67,21.5 10.43,21.23C10.43,21.23 9.36,20.13 8.57,18.5C7.78,16.87 7.3,14.81 8.38,12.77C9.5,10.67 11.5,10.16 13.26,10.67C15.04,11.19 16.53,12.74 16.5,15.03C16.46,15.38 16.71,15.68 17.06,15.7C17.4,15.73 17.7,15.47 17.73,15.06C17.79,12.2 15.87,10.13 13.61,9.47C13.04,9.31 12.45,9.23 11.86,9.25M12.08,14.25C11.73,14.26 11.46,14.55 11.47,14.89C11.47,14.89 11.5,16.37 12.31,17.8C13.15,19.23 14.93,20.59 18.03,20.3C18.37,20.28 18.64,20 18.62,19.64C18.6,19.29 18.3,19.03 17.91,19.06C15.19,19.31 14.04,18.28 13.39,17.17C12.74,16.07 12.72,14.88 12.72,14.88C12.72,14.53 12.44,14.25 12.08,14.25Z" />
|
|
||||||
</vector>
|
|
||||||
@@ -1,29 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2015 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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="32.0"
|
|
||||||
android:viewportHeight="32.0"
|
|
||||||
android:tint="?android:attr/colorControlNormal">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M20,20.2V24H6V5.3h8.7l2.4,-4H7.6c-2.2,0 -4,1.8 -4,4v21.3c0,2.2 1.8,4 4,4h10.7c2.2,0 4,-1.8 4,-4V14.9L20,20.2zM15.6,28h-5.3v-1.3h5.3V28z"/>
|
|
||||||
<path
|
|
||||||
android:fillColor="#FF000000"
|
|
||||||
android:pathData="M28.5,7l1.1,-2.4L32,3.5l-2.4,-1.1L28.5,0l-1.1,2.4L25,3.5l2.4,1.1L28.5,7zM21,7.4l-2.2,-4.8l-2.2,4.8l-4.8,2.2l4.8,2.2l2.2,4.8l2.2,-4.8l4.8,-2.2L21,7.4zM28.5,12.2l-1.1,2.4L25,15.6l2.4,1.1l1.1,2.4l1.1,-2.4l2.4,-1.1l-2.4,-1.1L28.5,12.2z"/>
|
|
||||||
</vector>
|
|
||||||
@@ -1,28 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (c) 2015 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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="32.0"
|
|
||||||
android:viewportHeight="32.0">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="M20,20.2V24H6V5.3h8.7l2.4,-4H7.6c-2.2,0 -4,1.8 -4,4v21.3c0,2.2 1.8,4 4,4h10.7c2.2,0 4,-1.8 4,-4V14.9L20,20.2zM15.6,28h-5.3v-1.3h5.3V28z"/>
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="M28.5,7l1.1,-2.4L32,3.5l-2.4,-1.1L28.5,0l-1.1,2.4L25,3.5l2.4,1.1L28.5,7zM21,7.4l-2.2,-4.8l-2.2,4.8l-4.8,2.2l4.8,2.2l2.2,4.8l2.2,-4.8l4.8,-2.2L21,7.4zM28.5,12.2l-1.1,2.4L25,15.6l2.4,1.1l1.1,2.4l1.1,-2.4l2.4,-1.1l-2.4,-1.1L28.5,12.2z"/>
|
|
||||||
</vector>
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (C) 2016 The Android Open Source 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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0"
|
|
||||||
android:tint="?android:attr/colorControlNormal">
|
|
||||||
<path
|
|
||||||
android:fillColor="#FFFFFFFF"
|
|
||||||
android:pathData="M9,11.24L9,7.5C9,6.12 10.12,5 11.5,5S14,6.12 14,7.5v3.74c1.21,-0.81 2,-2.18 2,-3.74C16,5.01 13.99,3 11.5,3S7,5.01 7,7.5c0,1.56 0.79,2.93 2,3.74zM18.84,15.87l-4.54,-2.26c-0.17,-0.07 -0.35,-0.11 -0.54,-0.11L13,13.5v-6c0,-0.83 -0.67,-1.5 -1.5,-1.5S10,6.67 10,7.5v10.74l-3.43,-0.72c-0.08,-0.01 -0.15,-0.03 -0.24,-0.03 -0.31,0 -0.59,0.13 -0.79,0.33l-0.79,0.8 4.94,4.94c0.27,0.27 0.65,0.44 1.06,0.44h6.79c0.75,0 1.33,-0.55 1.44,-1.28l0.75,-5.27c0.01,-0.07 0.02,-0.14 0.02,-0.2 0,-0.62 -0.38,-1.16 -0.91,-1.38z"/>
|
|
||||||
</vector>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) google/material-design-icons
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:height="24dp"
|
|
||||||
android:width="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?android:attr/colorControlNormal" >
|
|
||||||
<path android:fillColor="#000" android:pathData="M 10,9C 10,8.4477 10.4477,8 11,8C 11.5523,8 12,8.4477 12,9L 12,13.47L 13.21,13.6L 18.15,15.79C 18.6759,16.0317 19.0093,16.5613 19,17.14L 19,21.5C 18.974,22.3174 18.3174,22.974 17.5,23L 11,23C 10.6216,23.0009 10.2596,22.8453 10,22.57L 5.1,18.37L 5.84,17.6C 6.03083,17.3942 6.29936,17.2781 6.58,17.28L 6.8,17.28L 10,19L 10,9 Z M 3,4L 6,7L 6,5L 12,5L 12,3L 6,3L 6,1L 3,4 Z " />
|
|
||||||
</vector>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) google/material-design-icons
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:height="24dp"
|
|
||||||
android:width="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?android:attr/colorControlNormal" >
|
|
||||||
<path android:fillColor="#000" android:pathData="M 10,9C 10,8.4477 10.4477,8 11,8C 11.5523,8 12,8.4477 12,9L 12,13.47L 13.21,13.6L 18.15,15.79C 18.6759,16.0317 19.0093,16.5613 19,17.14L 19,21.5C 18.974,22.3174 18.3174,22.974 17.5,23L 11,23C 10.6216,23.0009 10.2596,22.8453 10,22.57L 5.1,18.37L 5.84,17.6C 6.03083,17.3942 6.29936,17.2781 6.58,17.28L 6.8,17.28L 10,19L 10,9 Z M 12,4L 9,1L 9,3L 3,3L 3,5L 9,5L 9,7L 12,4 Z " />
|
|
||||||
</vector>
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (c) google/material-design-icons
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:width="24dp"
|
|
||||||
android:height="24dp"
|
|
||||||
android:viewportWidth="24.0"
|
|
||||||
android:viewportHeight="24.0"
|
|
||||||
android:tint="?android:attr/colorControlNormal" >
|
|
||||||
<path
|
|
||||||
android:fillColor="#000"
|
|
||||||
android:pathData="M 10,9C 10,8.4477 10.4477,8 11,8C 11.5523,8 12,8.4477 12,9L 12,13.47L 13.21,13.6L 18.15,15.79C 18.6759,16.0317 19.0093,16.5613 19,17.14L 19,21.5C 18.974,22.3174 18.3174,22.974 17.5,23L 11,23C 10.6216,23.0009 10.2596,22.8453 10,22.57L 5.1,18.37L 5.84,17.6C 6.03083,17.3942 6.29936,17.2781 6.58,17.28L 6.8,17.28L 10,19L 10,9 Z M 11,5C 13.2091,5 15,6.79086 15,9C 15,10.4806 14.1956,11.7733 13,12.4649L 13,11.2361C 13.6137,10.6868 14,9.8885 14,9C 14,7.34315 12.6569,6 11,6C 9.34315,6 8,7.34315 8,9C 8,9.8885 8.38625,10.6868 9,11.2361L 9,12.4649C 7.8044,11.7733 7,10.4806 7,9C 7,6.79086 8.79086,5 11,5 Z "/>
|
|
||||||
</vector>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) google/material-design-icons
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:height="24dp"
|
|
||||||
android:width="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?android:attr/colorControlNormal" >
|
|
||||||
<path android:fillColor="#000" android:pathData="M 10,9C 10,8.45 10.45,8 11,8C 11.55,8 12,8.45 12,9L 12,13.47L 13.21,13.6L 18.15,15.79C 18.68,16.03 19,16.56 19,17.14L 19,21.5C 18.97,22.32 18.32,22.97 17.5,23L 11,23C 10.62,23 10.26,22.85 10,22.57L 5.1,18.37L 5.84,17.6C 6.03,17.39 6.3,17.28 6.58,17.28L 6.8,17.28L 10,19L 10,9 Z M 9,12.441L 9,9C 9,7.897 9.897,7 11,7C 12.103,7 13,7.897 13,9L 13,12.441C 14.188,11.746 15,10.469 15,9C 15,6.8 13.2,5 11,5C 8.8,5 7,6.8 7,9C 7,10.469 7.812,11.746 9,12.441 Z " />
|
|
||||||
</vector>
|
|
||||||
@@ -1,20 +0,0 @@
|
|||||||
<!--
|
|
||||||
Copyright (c) google/material-design-icons
|
|
||||||
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.
|
|
||||||
-->
|
|
||||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:height="24dp"
|
|
||||||
android:width="24dp"
|
|
||||||
android:viewportWidth="24"
|
|
||||||
android:viewportHeight="24"
|
|
||||||
android:tint="?android:attr/colorControlNormal" >
|
|
||||||
<path android:fillColor="#000" android:pathData="M 16,19L 8,19L 8,5L 16,5M 16.5,3L 7.5,3C 6.67,3 6,3.67 6,4.5L 6,19.5C 6,20.33 6.67,21 7.5,21L 16.5,21C 17.33,21 18,20.33 18,19.5L 18,4.5C 18,3.67 17.33,3 16.5,3 Z M 19,17L 21,17L 21,7L 19,7M 22,9L 22,15L 24,15L 24,9M 3,17L 5,17L 5,7L 3,7M 0,15L 2,15L 2,9L 0,9L 0,15 Z" />
|
|
||||||
</vector>
|
|
||||||
Binary file not shown.
|
Before Width: | Height: | Size: 56 KiB |
@@ -1,20 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2014 The Android Open Source 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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:color="?android:attr/colorControlHighlight">
|
|
||||||
<item android:drawable="?android:attr/colorSecondary" />
|
|
||||||
</ripple>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
/*
|
|
||||||
** Copyright 2020, ronaxdevil <pratabidya.007@gmail.com>
|
|
||||||
**
|
|
||||||
** 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.
|
|
||||||
*/
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_width="match_parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/motoactions_pic"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="160dp"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/motoactions_png" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
/*
|
|
||||||
** Copyright 2014, The Android Open Source Project
|
|
||||||
** Copyright 2020, ronaxdevil <pratabidya.007@gmail.com>
|
|
||||||
**
|
|
||||||
** 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.
|
|
||||||
*/
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_width="match_parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/ambient_pic"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="160dp"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/ambient_png" />
|
|
||||||
|
|
||||||
<include layout="@layout/switch_bar" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
/*
|
|
||||||
** Copyright 2014, The Android Open Source Project
|
|
||||||
** Copyright 2020, ronaxdevil <pratabidya.007@gmail.com>
|
|
||||||
**
|
|
||||||
** 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.
|
|
||||||
*/
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_width="match_parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/fpgesture_pic"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="160dp"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/fpgesture_png" />
|
|
||||||
|
|
||||||
<include layout="@layout/switch_bar" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,32 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
/*
|
|
||||||
** Copyright 2020, ronaxdevil <pratabidya.007@gmail.com>
|
|
||||||
**
|
|
||||||
** 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.
|
|
||||||
*/
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:layout_width="match_parent">
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/gesture_pic"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="160dp"
|
|
||||||
android:scaleType="centerCrop"
|
|
||||||
android:src="@drawable/gesture_png" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2016 The Android Open Source 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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Based off frameworks/base/core/res/res/layout/preference_category_material.xml
|
|
||||||
except that this supports icon -->
|
|
||||||
<FrameLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="8dp"
|
|
||||||
android:layout_marginBottom="8dp"
|
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart" >
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/icon_container"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
<com.android.internal.widget.PreferenceImageView
|
|
||||||
android:id="@android:id/icon"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:tint="?android:attr/textColorPrimary"
|
|
||||||
android:maxWidth="18dp"
|
|
||||||
android:maxHeight="18dp"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:paddingStart="56dp"
|
|
||||||
android:orientation="vertical">
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/title"
|
|
||||||
android:layout_marginTop="16dp"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Body2"
|
|
||||||
android:textColor="?android:attr/colorAccent"
|
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"/>
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/summary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:singleLine="true" />
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2015 The Android Open Source 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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<!-- Based off frameworks/base/core/res/res/layout/preference_material.xml
|
|
||||||
except that this has the negative margin on the image removed. -->
|
|
||||||
<LinearLayout
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minHeight="?android:attr/listPreferredItemHeightSmall"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart"
|
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
|
||||||
android:background="?android:attr/selectableItemBackground"
|
|
||||||
android:clipToPadding="false">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/icon_container"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minWidth="56dp"
|
|
||||||
android:gravity="start|center_vertical"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingEnd="12dp"
|
|
||||||
android:paddingTop="4dp"
|
|
||||||
android:paddingBottom="4dp">
|
|
||||||
<com.android.internal.widget.PreferenceImageView
|
|
||||||
android:id="@android:id/icon"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:maxWidth="48dp"
|
|
||||||
android:maxHeight="48dp"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<RelativeLayout
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:paddingTop="12dp"
|
|
||||||
android:paddingBottom="12dp">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/title"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minHeight="24dp"
|
|
||||||
android:singleLine="true"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceListItem"
|
|
||||||
android:ellipsize="marquee"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/summary"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:minHeight="24dp"
|
|
||||||
android:layout_below="@android:id/title"
|
|
||||||
android:layout_alignStart="@android:id/title"
|
|
||||||
android:textAppearance="?android:attr/textAppearanceListItemSecondary"
|
|
||||||
android:textColor="?android:attr/textColorSecondary"
|
|
||||||
android:maxLines="10"/>
|
|
||||||
|
|
||||||
</RelativeLayout>
|
|
||||||
|
|
||||||
<!-- Preference should place its actual preference widget here. -->
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@android:id/widget_frame"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:gravity="end|center_vertical"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:orientation="vertical"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,48 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!-- Copyright (C) 2016 The Android Open Source 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.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:id="@+id/switch_bar"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="?android:attr/actionBarSize"
|
|
||||||
android:background="@drawable/switchbar_background"
|
|
||||||
android:paddingStart="16dp"
|
|
||||||
android:paddingEnd="16dp"
|
|
||||||
android:clickable="true"
|
|
||||||
android:gravity="center">
|
|
||||||
|
|
||||||
<TextView android:id="@+id/switch_text"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:paddingStart="48dp"
|
|
||||||
android:maxLines="2"
|
|
||||||
android:ellipsize="end"
|
|
||||||
android:textAppearance="@android:style/TextAppearance.Material.Title"
|
|
||||||
android:textColor="?android:attr/textColorPrimary"
|
|
||||||
android:textAlignment="viewStart"
|
|
||||||
android:text="@string/switch_bar_on" />
|
|
||||||
|
|
||||||
<Switch
|
|
||||||
android:id="@android:id/switch_widget"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_vertical"
|
|
||||||
android:background="@null"
|
|
||||||
android:theme="@style/MotoActions.SwitchBar" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
@@ -1,80 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2013-2016 The CyanogenMod Project
|
|
||||||
(C) 2017 The LineageOS 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.
|
|
||||||
-->
|
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
|
||||||
<!-- Title and summary -->
|
|
||||||
<string name="moto_actions_title">Moto Ações</string>
|
|
||||||
|
|
||||||
<!-- Device gestures -->
|
|
||||||
<string name="device_gestures_title">Gestos do dispositivo</string>
|
|
||||||
<string name="device_gestures_summary">Gerenciar os gestos do dispositivo</string>
|
|
||||||
|
|
||||||
<!-- Ambient display gestures -->
|
|
||||||
<string name="ambient_display_manage_summary">Gerenciar os gestos da tela ambiente</string>
|
|
||||||
|
|
||||||
<!-- Fingerprint gestures -->
|
|
||||||
<string name="fingerprint_gestures_title">Gestos no sensor biométrico</string>
|
|
||||||
<string name="fingerprint_gestures_summary">Habilitar o uso de gestos no sensor biométrico</string>
|
|
||||||
<string name="fingerprint_gestures_manage_summary">Gerenciar os gestos do sensor biométrico</string>
|
|
||||||
<string name="fingerprint_actions_screenon">Ações com a tela ligada</string>
|
|
||||||
<string name="tap_title">Toque único</string>
|
|
||||||
<string name="tap_dlg_title">Selecione a ação para toque único</string>
|
|
||||||
<string name="double_tap_title">Toque duplo</string>
|
|
||||||
<string name="double_tap_dlg_title">Selecione a ação para toque duplo</string>
|
|
||||||
<string name="long_tap_title">Toque longo</string>
|
|
||||||
<string name="long_tap_dlg_title">Selecione a ação para toque longo</string>
|
|
||||||
<string name="touchscreen_swipe_left_title">Deslizar para a esquerda</string>
|
|
||||||
<string name="swipe_left_dlg_title">Selecione a ação para deslizar para a esquerda</string>
|
|
||||||
<string name="touchscreen_swipe_right_title">Deslizar para a direita</string>
|
|
||||||
<string name="swipe_right_dlg_title">Selecione a ação para deslizar para a direita</string>
|
|
||||||
|
|
||||||
<!-- Fingerprint gestures screen off -->
|
|
||||||
<string name="fingerprint_gestures_screenoff_title">Habilitar com a tela desligada</string>
|
|
||||||
<string name="fingerprint_gestures_screenoff_summary">Habilitar os gestos no sensor biométrico quando a tela estiver desligada.\n\nO desbloqueio por impressão digital deve estar desativado para usar esse recurso.</string>
|
|
||||||
<string name="fingerprint_actions_screenoff">Ações com a tela desligada</string>
|
|
||||||
|
|
||||||
<!-- Actions -->
|
|
||||||
<string name="action_none">Não fazer nada</string>
|
|
||||||
<string name="action_home">Início</string>
|
|
||||||
<string name="action_power">Ligar/desligar tela</string>
|
|
||||||
<string name="action_wake">Acordar o dispositivo</string>
|
|
||||||
<string name="action_back">Voltar</string>
|
|
||||||
<string name="action_recents">Recentes</string>
|
|
||||||
<string name="action_last_app">Último app</string>
|
|
||||||
<string name="action_volume_up">Aumentar volume</string>
|
|
||||||
<string name="action_volume_down">Diminuir volume</string>
|
|
||||||
<string name="action_voice_assistant">Assistente de voz</string>
|
|
||||||
<string name="action_play_pause">Tocar/pausar</string>
|
|
||||||
<string name="action_previous_track">Faixa anterior</string>
|
|
||||||
<string name="action_next_track">Próxima faixa</string>
|
|
||||||
<string name="action_flashlight">Ligar/desligar lanterna</string>
|
|
||||||
<string name="action_camera">Abrir câmera</string>
|
|
||||||
<string name="action_screenshot">Tirar uma captura de tela</string>
|
|
||||||
<string name="action_browser">Abrir navegador</string>
|
|
||||||
<string name="action_dialer">Abrir discador</string>
|
|
||||||
<string name="action_email">Abrir app de mail</string>
|
|
||||||
<string name="action_messages">Abrir app de mensagens</string>
|
|
||||||
|
|
||||||
<!-- Double tap to wake -->
|
|
||||||
<string name="tap_to_wake">Tocar para ativar</string>
|
|
||||||
<string name="tap_to_wake_summary">Toque duas vezes em qualquer parte da tela para ativar o dispositivo</string>
|
|
||||||
|
|
||||||
<!-- Screen off gestures haptic feedback -->
|
|
||||||
<string name="touchscreen_gesture_haptic_feedback">Retorno tátil</string>
|
|
||||||
<string name="touchscreen_gesture_haptic_feedback_summary">Vibrar quando um gesto for detectado</string>
|
|
||||||
|
|
||||||
</resources>
|
|
||||||
@@ -1,75 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2017 The LineageOS 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.
|
|
||||||
-->
|
|
||||||
<resources>
|
|
||||||
<string-array name="fp_keys_listArray">
|
|
||||||
<item>@string/action_none</item>
|
|
||||||
<item>@string/action_home</item>
|
|
||||||
<item>@string/action_power</item>
|
|
||||||
<item>@string/action_back</item>
|
|
||||||
<item>@string/action_recents</item>
|
|
||||||
<item>@string/action_last_app</item>
|
|
||||||
<item>@string/action_volume_up</item>
|
|
||||||
<item>@string/action_volume_down</item>
|
|
||||||
<item>@string/action_voice_assistant</item>
|
|
||||||
<item>@string/action_play_pause</item>
|
|
||||||
<item>@string/action_previous_track</item>
|
|
||||||
<item>@string/action_next_track</item>
|
|
||||||
<item>@string/action_flashlight</item>
|
|
||||||
<item>@string/action_camera</item>
|
|
||||||
<item>@string/action_screenshot</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="fp_keys_listValues">
|
|
||||||
<item>0</item>
|
|
||||||
<item>100</item> <!-- home -->
|
|
||||||
<item>101</item> <!-- power -->
|
|
||||||
<item>102</item> <!-- back -->
|
|
||||||
<item>103</item> <!-- recents -->
|
|
||||||
<item>121</item> <!-- last app -->
|
|
||||||
<item>104</item> <!-- volume up -->
|
|
||||||
<item>105</item> <!-- volume down -->
|
|
||||||
<item>106</item> <!-- voice assistant -->
|
|
||||||
<item>107</item> <!-- play/pause -->
|
|
||||||
<item>108</item> <!-- previous track -->
|
|
||||||
<item>109</item> <!-- next track -->
|
|
||||||
<item>110</item> <!-- flashlight -->
|
|
||||||
<item>111</item> <!-- camera -->
|
|
||||||
<item>112</item> <!-- screenshot -->
|
|
||||||
</string-array>
|
|
||||||
|
|
||||||
<string-array name="fp_keys_screen_off_listArray">
|
|
||||||
<item>@string/action_none</item>
|
|
||||||
<item>@string/action_power</item>
|
|
||||||
<item>@string/action_volume_up</item>
|
|
||||||
<item>@string/action_volume_down</item>
|
|
||||||
<item>@string/action_play_pause</item>
|
|
||||||
<item>@string/action_previous_track</item>
|
|
||||||
<item>@string/action_next_track</item>
|
|
||||||
<item>@string/action_flashlight</item>
|
|
||||||
<item>@string/action_camera</item>
|
|
||||||
</string-array>
|
|
||||||
<string-array name="fp_keys_screen_off_listValues">
|
|
||||||
<item>0</item>
|
|
||||||
<item>101</item> <!-- power -->
|
|
||||||
<item>104</item> <!-- volume up -->
|
|
||||||
<item>105</item> <!-- volume down -->
|
|
||||||
<item>107</item> <!-- play/pause -->
|
|
||||||
<item>108</item> <!-- previous track -->
|
|
||||||
<item>109</item> <!-- next track -->
|
|
||||||
<item>110</item> <!-- flashlight -->
|
|
||||||
<item>111</item> <!-- camera -->
|
|
||||||
</string-array>
|
|
||||||
</resources>
|
|
||||||
@@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2016 The CyanogenMod Project
|
|
||||||
Copyright (C) 2017 The LineageOS 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.
|
|
||||||
-->
|
|
||||||
<resources xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
|
|
||||||
|
|
||||||
<style name="MotoActions" parent="@android:style/Theme.DeviceDefault.Settings">
|
|
||||||
<item name="dialogPreferenceStyle">@style/MotoActions.DialogPreferenceStyle</item>
|
|
||||||
<item name="preferenceCategoryStyle">@style/MotoActions.PreferenceCategoryStyle</item>
|
|
||||||
<item name="preferenceFragmentStyle">@style/MotoActions.PreferenceFragmentStyle</item>
|
|
||||||
<item name="preferenceStyle">@style/MotoActions.PreferenceStyle</item>
|
|
||||||
<item name="preferenceTheme">@style/MotoActions.PreferenceTheme</item>
|
|
||||||
<item name="switchPreferenceStyle">@style/MotoActions.SwitchPreferenceStyle</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MotoActions.DialogPreferenceStyle" parent="@style/MotoActions.PreferenceStyle">
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MotoActions.PreferenceCategoryStyle" parent="@*android:style/Preference.DeviceDefault.Category">
|
|
||||||
<item name="allowDividerAbove">true</item>
|
|
||||||
<item name="allowDividerBelow">true</item>
|
|
||||||
<item name="android:layout">@layout/preference_category_material_settings</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MotoActions.PreferenceFragmentStyle" parent="@*android:style/PreferenceFragment.Material">
|
|
||||||
<item name="allowDividerAfterLastItem">false</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MotoActions.PreferenceStyle" parent="@*android:style/Preference.DeviceDefault">
|
|
||||||
<item name="allowDividerAbove">false</item>
|
|
||||||
<item name="allowDividerBelow">false</item>
|
|
||||||
<item name="singleLineTitle">false</item>
|
|
||||||
<item name="android:layout">@layout/preference_material_settings</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MotoActions.PreferenceTheme">
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MotoActions.SwitchPreferenceStyle" parent="@style/MotoActions.PreferenceStyle">
|
|
||||||
<item name="widgetLayout">@*android:layout/preference_widget_switch</item>
|
|
||||||
</style>
|
|
||||||
|
|
||||||
<style name="MotoActions.SwitchBar" parent="@android:style/ThemeOverlay.Material.ActionBar">
|
|
||||||
</style>
|
|
||||||
</resources>
|
|
||||||
@@ -1,56 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2015-2016 The CyanogenMod Project
|
|
||||||
Copyright (C) 2017 The LineageOS 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.
|
|
||||||
-->
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="gesture_camera_action"
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:title="@string/camera_gesture_title"
|
|
||||||
android:summary="@string/camera_gesture_summary"
|
|
||||||
android:icon="@drawable/ic_actions_twist" />
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="gesture_chop_chop"
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:title="@string/chop_chop_gesture_title"
|
|
||||||
android:summary="@string/chop_chop_gesture_summary"
|
|
||||||
android:icon="@drawable/ic_actions_chop" />
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="gesture_ir_silencer"
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:title="@string/hand_wave_silencer_title"
|
|
||||||
android:summary="@string/hand_wave_silencer_summary"
|
|
||||||
android:icon="@drawable/ic_actions_wave" />
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="gesture_flip_to_mute"
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:title="@string/flip_to_mute_title"
|
|
||||||
android:summary="@string/flip_to_mute_summary"
|
|
||||||
android:icon="@drawable/ic_actions_flip" />
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="gesture_lift_to_silence"
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:title="@string/lift_to_silence_title"
|
|
||||||
android:summary="@string/lift_to_silence_summary"
|
|
||||||
android:icon="@drawable/ic_actions_lift" />
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2017 The LineageOS 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.
|
|
||||||
-->
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="gesture_pick_up"
|
|
||||||
android:defaultValue="true"
|
|
||||||
android:title="@string/pick_up_gesture_title"
|
|
||||||
android:summary="@string/pick_up_gesture_summary"
|
|
||||||
android:icon="@drawable/ic_pickup" />
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="gesture_hand_wave"
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:title="@string/hand_wave_gesture_title"
|
|
||||||
android:summary="@string/hand_wave_gesture_summary"
|
|
||||||
android:icon="@drawable/ic_hand" />
|
|
||||||
</PreferenceScreen>
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2015-2016 The CyanogenMod Project
|
|
||||||
Copyright (C) 2017 The LineageOS 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.
|
|
||||||
-->
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="doze"
|
|
||||||
android:title="@string/ambient_display_title"
|
|
||||||
android:summary="@string/ambient_display_manage_summary"
|
|
||||||
android:icon="@drawable/ic_settings_doze" />
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
@@ -1,157 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2015-2016 The CyanogenMod Project
|
|
||||||
Copyright (C) 2017-2019 The LineageOS 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.
|
|
||||||
-->
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="fp_home_scr_off"
|
|
||||||
android:enabled="false"
|
|
||||||
android:title="@string/fingerprint_gestures_screenoff_title"
|
|
||||||
android:icon="@drawable/ic_fingerprint"
|
|
||||||
android:summary="@string/fingerprint_gestures_screenoff_summary" />
|
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:key="fp_keys_scr_on"
|
|
||||||
android:title="@string/fingerprint_actions_screenon" >
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="fp_haptic"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:icon="@drawable/ic_vibrate"
|
|
||||||
android:title="@string/touchscreen_gesture_haptic_feedback"
|
|
||||||
android:summary="@string/touchscreen_gesture_haptic_feedback_summary" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:title="@string/tap_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/tap_dlg_title"
|
|
||||||
android:key="fp_keys"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_listArray"
|
|
||||||
android:icon="@drawable/ic_tap"
|
|
||||||
android:entryValues="@array/fp_keys_listValues" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:title="@string/double_tap_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/double_tap_dlg_title"
|
|
||||||
android:key="fp_key_dbltap"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_listArray"
|
|
||||||
android:icon="@drawable/ic_double_tap"
|
|
||||||
android:entryValues="@array/fp_keys_listValues" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:title="@string/long_tap_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/long_tap_dlg_title"
|
|
||||||
android:key="fp_key_hold"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_listArray"
|
|
||||||
android:icon="@drawable/ic_tap_hold"
|
|
||||||
android:entryValues="@array/fp_keys_listValues" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:title="@string/touchscreen_swipe_left_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/swipe_left_dlg_title"
|
|
||||||
android:key="fp_key_left"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_listArray"
|
|
||||||
android:icon="@drawable/ic_swipe_left"
|
|
||||||
android:entryValues="@array/fp_keys_listValues" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:title="@string/touchscreen_swipe_right_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/swipe_right_dlg_title"
|
|
||||||
android:key="fp_key_right"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_listArray"
|
|
||||||
android:icon="@drawable/ic_swipe_right"
|
|
||||||
android:entryValues="@array/fp_keys_listValues" />
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
<PreferenceCategory
|
|
||||||
android:key="fp_keys_scr_off"
|
|
||||||
android:title="@string/fingerprint_actions_screenoff"
|
|
||||||
android:enabled="false" >
|
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:key="fp_haptic_scr_off"
|
|
||||||
android:dependency="fp_home_scr_off"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:icon="@drawable/ic_vibrate"
|
|
||||||
android:title="@string/touchscreen_gesture_haptic_feedback"
|
|
||||||
android:summary="@string/touchscreen_gesture_haptic_feedback_summary" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:dependency="fp_home_scr_off"
|
|
||||||
android:title="@string/tap_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/tap_dlg_title"
|
|
||||||
android:key="fp_keys_off"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_screen_off_listArray"
|
|
||||||
android:icon="@drawable/ic_tap"
|
|
||||||
android:entryValues="@array/fp_keys_screen_off_listValues" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:dependency="fp_home_scr_off"
|
|
||||||
android:title="@string/double_tap_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/double_tap_dlg_title"
|
|
||||||
android:key="fp_key_dbltap_off"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_screen_off_listArray"
|
|
||||||
android:icon="@drawable/ic_double_tap"
|
|
||||||
android:entryValues="@array/fp_keys_screen_off_listValues" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:dependency="fp_home_scr_off"
|
|
||||||
android:title="@string/long_tap_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/long_tap_dlg_title"
|
|
||||||
android:key="fp_key_hold_off"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_screen_off_listArray"
|
|
||||||
android:icon="@drawable/ic_tap_hold"
|
|
||||||
android:entryValues="@array/fp_keys_screen_off_listValues" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:dependency="fp_home_scr_off"
|
|
||||||
android:title="@string/touchscreen_swipe_left_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/swipe_left_dlg_title"
|
|
||||||
android:key="fp_key_left_off"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_screen_off_listArray"
|
|
||||||
android:icon="@drawable/ic_swipe_left"
|
|
||||||
android:entryValues="@array/fp_keys_screen_off_listValues" />
|
|
||||||
|
|
||||||
<ListPreference
|
|
||||||
android:dependency="fp_home_scr_off"
|
|
||||||
android:title="@string/touchscreen_swipe_right_title"
|
|
||||||
android:summary="%s"
|
|
||||||
android:dialogTitle="@string/swipe_right_dlg_title"
|
|
||||||
android:key="fp_key_right_off"
|
|
||||||
android:defaultValue="0"
|
|
||||||
android:entries="@array/fp_keys_screen_off_listArray"
|
|
||||||
android:icon="@drawable/ic_swipe_right"
|
|
||||||
android:entryValues="@array/fp_keys_screen_off_listValues" />
|
|
||||||
|
|
||||||
</PreferenceCategory>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
@@ -1,27 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2015-2016 The CyanogenMod Project
|
|
||||||
Copyright (C) 2017 The LineageOS 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.
|
|
||||||
-->
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="fp_gestures"
|
|
||||||
android:title="@string/fingerprint_gestures_title"
|
|
||||||
android:summary="@string/fingerprint_gestures_manage_summary"
|
|
||||||
android:icon="@drawable/ic_settings_fingerprint" />
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
@@ -1,51 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
Copyright (C) 2015-2016 The CyanogenMod Project
|
|
||||||
Copyright (C) 2017 The LineageOS 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.
|
|
||||||
-->
|
|
||||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:settings="http://schemas.android.com/apk/res/com.android.settings">
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="gestures"
|
|
||||||
android:title="@string/device_gestures_title"
|
|
||||||
android:summary="@string/device_gestures_summary"
|
|
||||||
android:icon="@drawable/ic_settings_gestures">
|
|
||||||
<intent
|
|
||||||
android:targetPackage="com.moto.actions"
|
|
||||||
android:targetClass="com.moto.actions.GestureSettingsActivity" />
|
|
||||||
</Preference>
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="doze"
|
|
||||||
android:title="@string/ambient_display_title"
|
|
||||||
android:summary="@string/ambient_display_manage_summary"
|
|
||||||
android:icon="@drawable/ic_settings_doze">
|
|
||||||
<intent
|
|
||||||
android:targetPackage="com.moto.actions"
|
|
||||||
android:targetClass="com.moto.actions.DozeSettingsActivity" />
|
|
||||||
</Preference>
|
|
||||||
|
|
||||||
<Preference
|
|
||||||
android:key="fp_gestures"
|
|
||||||
android:title="@string/fingerprint_gestures_title"
|
|
||||||
android:summary="@string/fingerprint_gestures_manage_summary"
|
|
||||||
android:icon="@drawable/ic_settings_fingerprint">
|
|
||||||
<intent
|
|
||||||
android:targetPackage="com.moto.actions"
|
|
||||||
android:targetClass="com.moto.actions.FPGestureSettingsActivity" />
|
|
||||||
</Preference>
|
|
||||||
|
|
||||||
</PreferenceScreen>
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 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.moto.actions;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
|
|
||||||
public class ActionsPreferenceActivity extends PreferenceActivity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
if (getActionBar() != null) {
|
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(android.R.id.content, new ActionsPreferenceFragment()).commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2015-2016 The CyanogenMod Project
|
|
||||||
* Copyright (C) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import androidx.preference.PreferenceFragment;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
public class ActionsPreferenceFragment extends PreferenceFragment {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
final View view = LayoutInflater.from(getContext()).inflate(R.layout.actions, container, false);
|
|
||||||
((ViewGroup) view).addView(super.onCreateView(inflater, container, savedInstanceState));
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
|
||||||
addPreferencesFromResource(R.xml.main_panel);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,68 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.content.ServiceConnection;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.actions.Constants;
|
|
||||||
import com.moto.actions.ServiceWrapper.LocalBinder;
|
|
||||||
|
|
||||||
public class BootCompletedReceiver extends BroadcastReceiver {
|
|
||||||
static final String TAG = "MotoActions";
|
|
||||||
final String NAVBAR_SHOWN = "navbar_shown";
|
|
||||||
|
|
||||||
private ServiceWrapper mServiceWrapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(final Context context, Intent intent) {
|
|
||||||
Log.i(TAG, "Booting");
|
|
||||||
|
|
||||||
if (intent.getAction() != null && !intent.getAction().equals(Intent.ACTION_BOOT_COMPLETED)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Restore nodes to saved preference values
|
|
||||||
for (String pref : Constants.sPrefKeys) {
|
|
||||||
Constants.writePreference(context, pref);
|
|
||||||
}
|
|
||||||
|
|
||||||
context.startService(new Intent(context, ServiceWrapper.class));
|
|
||||||
}
|
|
||||||
|
|
||||||
private ServiceConnection serviceConnection = new ServiceConnection() {
|
|
||||||
@Override
|
|
||||||
public void onServiceConnected(ComponentName className, IBinder service) {
|
|
||||||
LocalBinder binder = (LocalBinder) service;
|
|
||||||
mServiceWrapper = binder.getService();
|
|
||||||
mServiceWrapper.start();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onServiceDisconnected(ComponentName className) {
|
|
||||||
mServiceWrapper = null;
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,35 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 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.moto.actions;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
|
|
||||||
public class DozeSettingsActivity extends PreferenceActivity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
if (getActionBar() != null) {
|
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
getActionBar().setTitle(R.string.ambient_display_title);
|
|
||||||
}
|
|
||||||
|
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(android.R.id.content, new DozeSettingsFragment()).commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,101 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import androidx.preference.PreferenceFragment;
|
|
||||||
import android.provider.Settings;
|
|
||||||
import androidx.preference.Preference;
|
|
||||||
import androidx.preference.SwitchPreference;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.CompoundButton;
|
|
||||||
import android.widget.Switch;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
public class DozeSettingsFragment extends PreferenceFragment {
|
|
||||||
|
|
||||||
private SwitchPreference mHandwavePreference;
|
|
||||||
private SwitchPreference mPickupPreference;
|
|
||||||
|
|
||||||
private TextView mSwitchBarText;
|
|
||||||
private Switch mAmbientDisplaySwitch;
|
|
||||||
|
|
||||||
private String KEY_GESTURE_HAND_WAVE = "gesture_hand_wave";
|
|
||||||
private String KEY_GESTURE_PICK_UP = "gesture_pick_up";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
final View view = LayoutInflater.from(getContext()).inflate(R.layout.doze, container, false);
|
|
||||||
((ViewGroup) view).addView(super.onCreateView(inflater, container, savedInstanceState));
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
|
|
||||||
View switchBar = view.findViewById(R.id.switch_bar);
|
|
||||||
mAmbientDisplaySwitch = (Switch) switchBar.findViewById(android.R.id.switch_widget);
|
|
||||||
mAmbientDisplaySwitch.setChecked(MotoActionsSettings.isDozeEnabled(getActivity().getContentResolver()));
|
|
||||||
mAmbientDisplaySwitch.setOnCheckedChangeListener(mAmbientDisplayPrefListener);
|
|
||||||
|
|
||||||
switchBar.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
mAmbientDisplaySwitch.toggle();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mSwitchBarText = switchBar.findViewById(R.id.switch_text);
|
|
||||||
mSwitchBarText.setText(MotoActionsSettings.isDozeEnabled(getActivity().getContentResolver()) ? R.string.switch_bar_on :
|
|
||||||
R.string.switch_bar_off);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
|
||||||
addPreferencesFromResource(R.xml.doze_panel);
|
|
||||||
boolean dozeEnabled = MotoActionsSettings.isDozeEnabled(getActivity().getContentResolver());
|
|
||||||
mHandwavePreference = (SwitchPreference) findPreference(KEY_GESTURE_HAND_WAVE);
|
|
||||||
mPickupPreference = (SwitchPreference) findPreference(KEY_GESTURE_PICK_UP);
|
|
||||||
updatePrefs(dozeEnabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
private CompoundButton.OnCheckedChangeListener mAmbientDisplayPrefListener =
|
|
||||||
new CompoundButton.OnCheckedChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean enable) {
|
|
||||||
if (enableDoze(enable)) {
|
|
||||||
updatePrefs(enable);
|
|
||||||
mSwitchBarText.setText(enable ? R.string.switch_bar_on : R.string.switch_bar_off);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void updatePrefs(boolean enabled){
|
|
||||||
mHandwavePreference.setEnabled(enabled);
|
|
||||||
mPickupPreference.setEnabled(enabled);
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean enableDoze(boolean enable) {
|
|
||||||
return Settings.Secure.putInt(getActivity().getContentResolver(),
|
|
||||||
Settings.Secure.DOZE_ENABLED, enable ? 1 : 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,37 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 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.moto.actions;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
|
|
||||||
public class FPGestureSettingsActivity extends PreferenceActivity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
if (getActionBar() != null) {
|
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
getActionBar().setTitle(R.string.fingerprint_gestures_title);
|
|
||||||
}
|
|
||||||
|
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(android.R.id.content, new FPGestureSettingsFragment()).commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,120 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 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.moto.actions;
|
|
||||||
|
|
||||||
import android.app.ActionBar;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences.Editor;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import androidx.preference.PreferenceCategory;
|
|
||||||
import androidx.preference.SwitchPreference;
|
|
||||||
import android.hardware.fingerprint.FingerprintManager;
|
|
||||||
import androidx.preference.PreferenceFragment;
|
|
||||||
import android.view.MenuItem;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.CompoundButton;
|
|
||||||
import android.widget.Switch;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import com.moto.actions.actions.Constants;
|
|
||||||
|
|
||||||
import static com.moto.actions.actions.Constants.FP_HOME_KEY;
|
|
||||||
import static com.moto.actions.actions.Constants.FP_HOME_KEY_OFF;
|
|
||||||
|
|
||||||
public class FPGestureSettingsFragment extends PreferenceFragment {
|
|
||||||
|
|
||||||
private SwitchPreference mFPScreenOffGesture;
|
|
||||||
private PreferenceCategory mFPScreenOffCategory;
|
|
||||||
private PreferenceCategory mFPScreenOnCategory;
|
|
||||||
|
|
||||||
private TextView mSwitchBarText;
|
|
||||||
private Switch mFPGestureSwitch;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
final View view = LayoutInflater.from(getContext()).inflate(R.layout.fp_gesture, container, false);
|
|
||||||
((ViewGroup) view).addView(super.onCreateView(inflater, container, savedInstanceState));
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onViewCreated(View view, Bundle savedInstanceState) {
|
|
||||||
super.onViewCreated(view, savedInstanceState);
|
|
||||||
|
|
||||||
View switchBar = view.findViewById(R.id.switch_bar);
|
|
||||||
mFPGestureSwitch = (Switch) switchBar.findViewById(android.R.id.switch_widget);
|
|
||||||
mFPGestureSwitch.setChecked(isFPGestureEnabled());
|
|
||||||
mFPGestureSwitch.setOnCheckedChangeListener(mFPGesturePrefListener);
|
|
||||||
|
|
||||||
switchBar.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
mFPGestureSwitch.toggle();
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
mSwitchBarText = switchBar.findViewById(R.id.switch_text);
|
|
||||||
mSwitchBarText.setText(isFPGestureEnabled() ? R.string.switch_bar_on :
|
|
||||||
R.string.switch_bar_off);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updatePrefs(boolean enabled){
|
|
||||||
Editor prefEditor = PreferenceManager.getDefaultSharedPreferences(getActivity()).edit();
|
|
||||||
prefEditor.putBoolean(FP_HOME_KEY, enabled);
|
|
||||||
prefEditor.apply();
|
|
||||||
mFPScreenOnCategory.setEnabled(enabled);
|
|
||||||
mFPScreenOffGesture.setEnabled(enabled);
|
|
||||||
mFPScreenOffCategory.setEnabled(enabled);
|
|
||||||
if(enabled){
|
|
||||||
boolean hasEnrolledFingerprints = hasEnrolledFingerprints();
|
|
||||||
mFPScreenOffGesture.setEnabled(!hasEnrolledFingerprints);
|
|
||||||
mFPScreenOffCategory.setEnabled(!hasEnrolledFingerprints);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isFPGestureEnabled(){
|
|
||||||
return Constants.isPreferenceEnabled(getActivity(), FP_HOME_KEY);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
|
||||||
addPreferencesFromResource(R.xml.fp_gesture_panel);
|
|
||||||
mFPScreenOffGesture = (SwitchPreference) findPreference(FP_HOME_KEY_OFF);
|
|
||||||
mFPScreenOffCategory = (PreferenceCategory) findPreference("fp_keys_scr_off");
|
|
||||||
mFPScreenOnCategory = (PreferenceCategory) findPreference("fp_keys_scr_on");
|
|
||||||
updatePrefs(isFPGestureEnabled());
|
|
||||||
}
|
|
||||||
|
|
||||||
private CompoundButton.OnCheckedChangeListener mFPGesturePrefListener =
|
|
||||||
new CompoundButton.OnCheckedChangeListener() {
|
|
||||||
@Override
|
|
||||||
public void onCheckedChanged(CompoundButton compoundButton, boolean enable) {
|
|
||||||
updatePrefs(enable);
|
|
||||||
mSwitchBarText.setText(enable ? R.string.switch_bar_on : R.string.switch_bar_off);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private boolean hasEnrolledFingerprints(){
|
|
||||||
FingerprintManager fingerprintManager = (FingerprintManager) getActivity().getSystemService(Context.FINGERPRINT_SERVICE);
|
|
||||||
return fingerprintManager.hasEnrolledFingerprints();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,36 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 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.moto.actions;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
|
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
|
|
||||||
public class GestureSettingsActivity extends PreferenceActivity {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
|
||||||
super.onCreate(savedInstanceState);
|
|
||||||
|
|
||||||
if (getActionBar() != null) {
|
|
||||||
getActionBar().setDisplayHomeAsUpEnabled(true);
|
|
||||||
}
|
|
||||||
|
|
||||||
getFragmentManager().beginTransaction()
|
|
||||||
.replace(android.R.id.content, new GestureSettingsFragment()).commit();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,40 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 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.moto.actions;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import androidx.preference.PreferenceFragment;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
|
|
||||||
public class GestureSettingsFragment extends PreferenceFragment {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
|
||||||
Bundle savedInstanceState) {
|
|
||||||
final View view = LayoutInflater.from(getContext()).inflate(R.layout.gesture, container, false);
|
|
||||||
((ViewGroup) view).addView(super.onCreateView(inflater, container, savedInstanceState));
|
|
||||||
return view;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
|
|
||||||
addPreferencesFromResource(R.xml.actions_panel);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,756 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 The CyanogenMod Project
|
|
||||||
* Copyright (C) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
import android.app.ActivityManager;
|
|
||||||
import android.app.ActivityManagerNative;
|
|
||||||
import android.app.ISearchManager;
|
|
||||||
import android.app.KeyguardManager;
|
|
||||||
import android.content.ActivityNotFoundException;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.ActivityInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.pm.ResolveInfo;
|
|
||||||
import android.content.res.Resources;
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.camera2.CameraAccessException;
|
|
||||||
import android.hardware.camera2.CameraCharacteristics;
|
|
||||||
import android.hardware.camera2.CameraManager;
|
|
||||||
import android.hardware.input.InputManager;
|
|
||||||
import android.media.AudioAttributes;
|
|
||||||
import android.media.session.MediaSessionLegacyHelper;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.Handler;
|
|
||||||
import android.os.Looper;
|
|
||||||
import android.os.Message;
|
|
||||||
import android.os.PowerManager;
|
|
||||||
import android.os.PowerManager.WakeLock;
|
|
||||||
import android.os.RemoteException;
|
|
||||||
import android.os.ServiceManager;
|
|
||||||
import android.os.SystemClock;
|
|
||||||
import android.os.UserHandle;
|
|
||||||
import android.os.VibrationEffect;
|
|
||||||
import android.os.Vibrator;
|
|
||||||
import android.provider.MediaStore;
|
|
||||||
import android.provider.Settings;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.InputDevice;
|
|
||||||
import android.view.KeyCharacterMap;
|
|
||||||
import android.view.KeyEvent;
|
|
||||||
import android.view.ViewConfiguration;
|
|
||||||
|
|
||||||
import com.android.internal.os.DeviceKeyHandler;
|
|
||||||
import com.android.internal.util.ArrayUtils;
|
|
||||||
|
|
||||||
import com.moto.actions.util.FileUtils;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static com.moto.actions.actions.Constants.*;
|
|
||||||
|
|
||||||
public class KeyHandler implements DeviceKeyHandler {
|
|
||||||
|
|
||||||
private static final String TAG = KeyHandler.class.getSimpleName();
|
|
||||||
|
|
||||||
private static final int GESTURE_REQUEST = 1;
|
|
||||||
private static final int FP_ACTION_REQUEST = 2;
|
|
||||||
|
|
||||||
private static final String ACTION_DISMISS_KEYGUARD =
|
|
||||||
"com.android.keyguard.action.DISMISS_KEYGUARD_SECURELY";
|
|
||||||
|
|
||||||
private static final String GESTURE_WAKEUP_REASON = "keyhandler-gesture-wakeup";
|
|
||||||
private static final int GESTURE_WAKELOCK_DURATION = 3000;
|
|
||||||
private static final AudioAttributes VIBRATION_ATTRIBUTES = new AudioAttributes.Builder()
|
|
||||||
.setContentType(AudioAttributes.CONTENT_TYPE_SONIFICATION)
|
|
||||||
.setUsage(AudioAttributes.USAGE_ASSISTANCE_SONIFICATION)
|
|
||||||
.build();
|
|
||||||
private final Context mContext;
|
|
||||||
private final PowerManager mPowerManager;
|
|
||||||
WakeLock mGestureWakeLock;
|
|
||||||
private KeyguardManager mKeyguardManager;
|
|
||||||
private FPScreenOffGesturesHandler mFPScreenOffGesturesHandler;
|
|
||||||
private CameraManager mCameraManager;
|
|
||||||
private String mRearCameraId;
|
|
||||||
private boolean mTorchEnabled;
|
|
||||||
private Vibrator mVibrator;
|
|
||||||
private ISearchManager mSearchManagerService;
|
|
||||||
private Handler mHandler;
|
|
||||||
private int fpTapCounts = 0;
|
|
||||||
private boolean fpTapPending = false;
|
|
||||||
private boolean fpGesturePending = false;
|
|
||||||
private Runnable doubleTapRunnable = new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
int action = 0;
|
|
||||||
if (fpTapCounts > 1) {
|
|
||||||
action = str2int(FileUtils.readOneLine(getFPNodeBasedOnScreenState(FP_KEY_DBLTAP_NODE)));
|
|
||||||
} else {
|
|
||||||
if (isSingleTapEnabledOnFP()) {
|
|
||||||
action = str2int(FileUtils.readOneLine(getFPNodeBasedOnScreenState(FP_KEYS_NODE)));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (action != 0) {
|
|
||||||
boolean isActionSupported = ArrayUtils.contains(mPowerManager.isScreenOn() ? sFPSupportedActions : sFPSupportedActionsScreenOff, action);
|
|
||||||
if (isActionSupported) {
|
|
||||||
fireFPAction(action, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
resetDoubleTapOnFP();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
private Runnable fpGestureRunnable = new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
resetFPGestureDelay();
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
public KeyHandler(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
|
|
||||||
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
|
||||||
mFPScreenOffGesturesHandler = new FPScreenOffGesturesHandler();
|
|
||||||
|
|
||||||
mGestureWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,
|
|
||||||
"GestureWakeLock");
|
|
||||||
|
|
||||||
mVibrator = (Vibrator) context.getSystemService(Context.VIBRATOR_SERVICE);
|
|
||||||
if (mVibrator == null || !mVibrator.hasVibrator()) {
|
|
||||||
mVibrator = null;
|
|
||||||
}
|
|
||||||
|
|
||||||
mCameraManager = (CameraManager) mContext.getSystemService(Context.CAMERA_SERVICE);
|
|
||||||
mCameraManager.registerTorchCallback(new MyTorchCallback(), null);
|
|
||||||
|
|
||||||
mHandler = new Handler(Looper.getMainLooper());
|
|
||||||
}
|
|
||||||
|
|
||||||
static long[] getLongIntArray(Resources r, int resid) {
|
|
||||||
int[] ar = r.getIntArray(resid);
|
|
||||||
if (ar == null) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
long[] out = new long[ar.length];
|
|
||||||
for (int i = 0; i < ar.length; i++) {
|
|
||||||
out[i] = ar[i];
|
|
||||||
}
|
|
||||||
return out;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ActivityInfo getRunningActivityInfo(Context context) {
|
|
||||||
final ActivityManager am = (ActivityManager) context
|
|
||||||
.getSystemService(Context.ACTIVITY_SERVICE);
|
|
||||||
final PackageManager pm = context.getPackageManager();
|
|
||||||
|
|
||||||
List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(1);
|
|
||||||
if (tasks != null && !tasks.isEmpty()) {
|
|
||||||
ActivityManager.RunningTaskInfo top = tasks.get(0);
|
|
||||||
try {
|
|
||||||
return pm.getActivityInfo(top.topActivity, 0);
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void dispatchMediaKeyWithWakeLock(int keycode, Context context) {
|
|
||||||
if (ActivityManagerNative.isSystemReady()) {
|
|
||||||
KeyEvent event = new KeyEvent(SystemClock.uptimeMillis(),
|
|
||||||
SystemClock.uptimeMillis(), KeyEvent.ACTION_DOWN, keycode, 0);
|
|
||||||
MediaSessionLegacyHelper.getHelper(context).sendMediaButtonEvent(event, true);
|
|
||||||
event = KeyEvent.changeAction(event, KeyEvent.ACTION_UP);
|
|
||||||
MediaSessionLegacyHelper.getHelper(context).sendMediaButtonEvent(event, true);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void switchToLastApp(Context context) {
|
|
||||||
final ActivityManager am =
|
|
||||||
(ActivityManager) context.getSystemService(Context.ACTIVITY_SERVICE);
|
|
||||||
ActivityManager.RunningTaskInfo lastTask = getLastTask(context, am);
|
|
||||||
|
|
||||||
if (lastTask != null) {
|
|
||||||
am.moveTaskToFront(lastTask.id, ActivityManager.MOVE_TASK_NO_USER_ACTION);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private static ActivityManager.RunningTaskInfo getLastTask(Context context,
|
|
||||||
final ActivityManager am) {
|
|
||||||
final String defaultHomePackage = resolveCurrentLauncherPackage(context);
|
|
||||||
List<ActivityManager.RunningTaskInfo> tasks = am.getRunningTasks(5);
|
|
||||||
|
|
||||||
for (int i = 1; i < tasks.size(); i++) {
|
|
||||||
String packageName = tasks.get(i).topActivity.getPackageName();
|
|
||||||
if (!packageName.equals(defaultHomePackage)
|
|
||||||
&& !packageName.equals(context.getPackageName())
|
|
||||||
&& !packageName.equals("com.android.systemui")) {
|
|
||||||
return tasks.get(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static String resolveCurrentLauncherPackage(Context context) {
|
|
||||||
final Intent launcherIntent = new Intent(Intent.ACTION_MAIN)
|
|
||||||
.addCategory(Intent.CATEGORY_HOME);
|
|
||||||
final PackageManager pm = context.getPackageManager();
|
|
||||||
final ResolveInfo launcherInfo = pm.resolveActivity(launcherIntent, 0);
|
|
||||||
return launcherInfo.activityInfo.packageName;
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getRearCameraId() {
|
|
||||||
if (mRearCameraId == null) {
|
|
||||||
try {
|
|
||||||
for (final String cameraId : mCameraManager.getCameraIdList()) {
|
|
||||||
CameraCharacteristics characteristics =
|
|
||||||
mCameraManager.getCameraCharacteristics(cameraId);
|
|
||||||
int cOrientation = characteristics.get(CameraCharacteristics.LENS_FACING);
|
|
||||||
if (cOrientation == CameraCharacteristics.LENS_FACING_BACK) {
|
|
||||||
mRearCameraId = cameraId;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (CameraAccessException e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return mRearCameraId;
|
|
||||||
}
|
|
||||||
|
|
||||||
private Intent getLaunchableIntent(Intent intent) {
|
|
||||||
PackageManager pm = mContext.getPackageManager();
|
|
||||||
List<ResolveInfo> resInfo = pm.queryIntentActivities(intent, 0);
|
|
||||||
if (resInfo.isEmpty()) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
return pm.getLaunchIntentForPackage(resInfo.get(0).activityInfo.packageName);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void triggerCameraAction() {
|
|
||||||
ensureKeyguardManager();
|
|
||||||
WakeLock wl = mPowerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, "GestureWakeLock");
|
|
||||||
wl.acquire(500);
|
|
||||||
if (mKeyguardManager.inKeyguardRestrictedInputMode()) {
|
|
||||||
launchSecureCamera();
|
|
||||||
} else {
|
|
||||||
launchCamera();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void launchCamera() {
|
|
||||||
Intent intent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
|
|
||||||
if (getBestActivityInfo(intent) != null) {
|
|
||||||
// Only launch if we can succeed, but let the user pick the action
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void launchSecureCamera() {
|
|
||||||
// Keyguard won't allow a picker, try to pick the secure intent in the package
|
|
||||||
// that would be the one used for a default action of launching the camera
|
|
||||||
Intent normalIntent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
|
|
||||||
normalIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
normalIntent.addFlags(Intent.FLAG_FROM_BACKGROUND);
|
|
||||||
|
|
||||||
Intent secureIntent = new Intent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE);
|
|
||||||
secureIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
secureIntent.addFlags(Intent.FLAG_FROM_BACKGROUND);
|
|
||||||
|
|
||||||
ActivityInfo normalActivity = getBestActivityInfo(normalIntent);
|
|
||||||
ActivityInfo secureActivity = getBestActivityInfo(secureIntent, normalActivity);
|
|
||||||
if (secureActivity != null) {
|
|
||||||
secureIntent.setComponent(new ComponentName(secureActivity.applicationInfo.packageName, secureActivity.name));
|
|
||||||
mContext.startActivity(secureIntent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ActivityInfo getBestActivityInfo(Intent intent) {
|
|
||||||
PackageManager pm = mContext.getPackageManager();
|
|
||||||
ResolveInfo resolveInfo = pm.resolveActivity(intent, 0);
|
|
||||||
if (resolveInfo != null) {
|
|
||||||
return resolveInfo.activityInfo;
|
|
||||||
} else {
|
|
||||||
// If the resolving failed, just find our own best match
|
|
||||||
return getBestActivityInfo(intent, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ActivityInfo getBestActivityInfo(Intent intent, ActivityInfo match) {
|
|
||||||
PackageManager pm = mContext.getPackageManager();
|
|
||||||
List<ResolveInfo> activities = pm.queryIntentActivities(intent, 0);
|
|
||||||
ActivityInfo best = null;
|
|
||||||
if (activities.size() > 0) {
|
|
||||||
best = activities.get(0).activityInfo;
|
|
||||||
if (match != null) {
|
|
||||||
String packageName = match.applicationInfo.packageName;
|
|
||||||
for (int i = activities.size() - 1; i >= 0; i--) {
|
|
||||||
ActivityInfo activityInfo = activities.get(i).activityInfo;
|
|
||||||
if (packageName.equals(activityInfo.applicationInfo.packageName)) {
|
|
||||||
best = activityInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return best;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openBrowser() {
|
|
||||||
mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION);
|
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis(), GESTURE_WAKEUP_REASON);
|
|
||||||
final Intent intent = getLaunchableIntent(
|
|
||||||
new Intent(Intent.ACTION_VIEW, Uri.parse("http:")));
|
|
||||||
startActivitySafely(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openDialer() {
|
|
||||||
mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION);
|
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis(), GESTURE_WAKEUP_REASON);
|
|
||||||
final Intent intent = new Intent(Intent.ACTION_DIAL, null);
|
|
||||||
startActivitySafely(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openEmail() {
|
|
||||||
mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION);
|
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis(), GESTURE_WAKEUP_REASON);
|
|
||||||
final Intent intent = getLaunchableIntent(
|
|
||||||
new Intent(Intent.ACTION_VIEW, Uri.parse("mailto:")));
|
|
||||||
startActivitySafely(intent);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void openMessages() {
|
|
||||||
mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION);
|
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis(), GESTURE_WAKEUP_REASON);
|
|
||||||
final String defaultApplication = Settings.Secure.getString(
|
|
||||||
mContext.getContentResolver(), "sms_default_application");
|
|
||||||
final PackageManager pm = mContext.getPackageManager();
|
|
||||||
final Intent intent = pm.getLaunchIntentForPackage(defaultApplication);
|
|
||||||
if (intent != null) {
|
|
||||||
startActivitySafely(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toggleFlashlight() {
|
|
||||||
String rearCameraId = getRearCameraId();
|
|
||||||
if (rearCameraId != null) {
|
|
||||||
mGestureWakeLock.acquire(GESTURE_WAKELOCK_DURATION);
|
|
||||||
try {
|
|
||||||
mCameraManager.setTorchMode(rearCameraId, !mTorchEnabled);
|
|
||||||
mTorchEnabled = !mTorchEnabled;
|
|
||||||
} catch (CameraAccessException e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void ensureKeyguardManager() {
|
|
||||||
if (mKeyguardManager == null) {
|
|
||||||
mKeyguardManager =
|
|
||||||
(KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resetDoubleTapOnFP() {
|
|
||||||
fpTapCounts = 0;
|
|
||||||
fpTapPending = false;
|
|
||||||
mHandler.removeCallbacks(doubleTapRunnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void detectDoubleTapOnFP() {
|
|
||||||
fpTapCounts++;
|
|
||||||
if (fpTapCounts == 1 || fpTapCounts == 2) {
|
|
||||||
doHapticFeedbackFP(false);
|
|
||||||
}
|
|
||||||
if (!fpTapPending) {
|
|
||||||
fpTapPending = true;
|
|
||||||
mHandler.postDelayed(doubleTapRunnable, ViewConfiguration.getDoubleTapTimeout());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isSingleTapEnabledOnFP() {
|
|
||||||
return !FileUtils.readOneLine(getFPNodeBasedOnScreenState(FP_KEYS_NODE)).equals("0");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isDoubleTapEnabledOnFP() {
|
|
||||||
return !FileUtils.readOneLine(getFPNodeBasedOnScreenState(FP_KEY_DBLTAP_NODE)).equals("0");
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean isHapticFeedbackEnabledOnFP() {
|
|
||||||
return !FileUtils.readOneLine(getFPNodeBasedOnScreenState(FP_HAPTIC_NODE)).equals("0");
|
|
||||||
}
|
|
||||||
|
|
||||||
private String getFPNodeBasedOnScreenState(String node) {
|
|
||||||
if (mPowerManager.isScreenOn()) {
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
switch (node) {
|
|
||||||
case FP_KEYS_NODE:
|
|
||||||
return FP_KEYS_SCREENOFF_NODE;
|
|
||||||
case FP_HAPTIC_NODE:
|
|
||||||
return FP_HAPTIC_SCREENOFF_NODE;
|
|
||||||
case FP_KEY_DBLTAP_NODE:
|
|
||||||
return FP_KEY_SCREENOFF_DBLTAP_NODE;
|
|
||||||
case FP_KEY_HOLD_NODE:
|
|
||||||
return FP_KEY_SCREENOFF_HOLD_NODE;
|
|
||||||
case FP_KEY_RIGHT_NODE:
|
|
||||||
return FP_KEY_SCREENOFF_RIGHT_NODE;
|
|
||||||
case FP_KEY_LEFT_NODE:
|
|
||||||
return FP_KEY_SCREENOFF_LEFT_NODE;
|
|
||||||
}
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
public KeyEvent handleKeyEvent(KeyEvent event) {
|
|
||||||
int scanCode = event.getScanCode();
|
|
||||||
|
|
||||||
if (DEBUG) {
|
|
||||||
Log.d(TAG, "DEBUG: action=" + event.getAction()
|
|
||||||
+ ", flags=" + event.getFlags()
|
|
||||||
+ ", keyCode=" + event.getKeyCode()
|
|
||||||
+ ", scanCode=" + event.getScanCode()
|
|
||||||
+ ", metaState=" + event.getMetaState()
|
|
||||||
+ ", repeatCount=" + event.getRepeatCount());
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isFPScanCode = ArrayUtils.contains(sSupportedFPGestures, scanCode);
|
|
||||||
if (!isFPScanCode) {
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
|
|
||||||
boolean isFPGestureEnabled = FileUtils.readOneLine(FP_HOME_NODE).equals("1");
|
|
||||||
boolean isFPGestureEnabledOnScreenOff = FileUtils.readOneLine(FP_HOME_OFF_NODE).equals("1");
|
|
||||||
|
|
||||||
boolean isScreenOn = mPowerManager.isScreenOn();
|
|
||||||
|
|
||||||
// We only want ACTION_UP event
|
|
||||||
if (event.getAction() != KeyEvent.ACTION_UP) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFPScanCode){
|
|
||||||
if (fpGesturePending) {
|
|
||||||
return event;
|
|
||||||
} else {
|
|
||||||
resetFPGestureDelay();
|
|
||||||
fpGesturePending = true;
|
|
||||||
mHandler.postDelayed(fpGestureRunnable, 10);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (scanCode != FP_TAP_SCANCODE) {
|
|
||||||
resetDoubleTapOnFP();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isFPScanCode) {
|
|
||||||
if ((!isFPGestureEnabled) || (!isScreenOn && !isFPGestureEnabledOnScreenOff)) {
|
|
||||||
resetDoubleTapOnFP();
|
|
||||||
return event;
|
|
||||||
}
|
|
||||||
if (!isScreenOn && isFPGestureEnabledOnScreenOff) {
|
|
||||||
processFPScreenOffScancode(scanCode);
|
|
||||||
} else {
|
|
||||||
processFPScancode(scanCode);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processFPScancode(int scanCode) {
|
|
||||||
int action = 0;
|
|
||||||
boolean isScreenOn = mPowerManager.isScreenOn();
|
|
||||||
switch (scanCode) {
|
|
||||||
case FP_TAP_SCANCODE:
|
|
||||||
if (isDoubleTapEnabledOnFP()) {
|
|
||||||
detectDoubleTapOnFP();
|
|
||||||
return;
|
|
||||||
} else {
|
|
||||||
resetDoubleTapOnFP();
|
|
||||||
action = str2int(FileUtils.readOneLine(getFPNodeBasedOnScreenState(FP_KEYS_NODE)));
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case FP_HOLD_SCANCODE:
|
|
||||||
action = str2int(FileUtils.readOneLine(getFPNodeBasedOnScreenState(FP_KEY_HOLD_NODE)));
|
|
||||||
break;
|
|
||||||
case FP_RIGHT_SCANCODE:
|
|
||||||
action = str2int(FileUtils.readOneLine(getFPNodeBasedOnScreenState(FP_KEY_RIGHT_NODE)));
|
|
||||||
break;
|
|
||||||
case FP_LEFT_SCANCODE:
|
|
||||||
action = str2int(FileUtils.readOneLine(getFPNodeBasedOnScreenState(FP_KEY_LEFT_NODE)));
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
boolean isActionSupported = ArrayUtils.contains(isScreenOn ? sFPSupportedActions : sFPSupportedActionsScreenOff, action);
|
|
||||||
if (isActionSupported) {
|
|
||||||
fireFPAction(action, false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fireFPAction(int action, boolean isDoubleTap) {
|
|
||||||
ensureKeyguardManager();
|
|
||||||
boolean isHapticFeedbackEnabledOnFP = isHapticFeedbackEnabledOnFP();
|
|
||||||
if (isDoubleTap && action != ACTION_CAMERA && action != ACTION_FLASHLIGHT) {
|
|
||||||
isHapticFeedbackEnabledOnFP = false;
|
|
||||||
}
|
|
||||||
if (isHapticFeedbackEnabledOnFP){
|
|
||||||
if (action == ACTION_CAMERA || action == ACTION_FLASHLIGHT) {
|
|
||||||
vibrate(action == ACTION_CAMERA ? 500 : 250);
|
|
||||||
}else if (action != ACTION_VOICE_ASSISTANT) {
|
|
||||||
doHapticFeedbackFP(false);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
switch (action) {
|
|
||||||
case ACTION_HOME:
|
|
||||||
if (!mKeyguardManager.inKeyguardRestrictedInputMode()) {
|
|
||||||
triggerVirtualKeypress(mHandler, KeyEvent.KEYCODE_HOME);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ACTION_POWER:
|
|
||||||
toggleScreenState();
|
|
||||||
break;
|
|
||||||
case ACTION_BACK:
|
|
||||||
triggerVirtualKeypress(mHandler, KeyEvent.KEYCODE_BACK);
|
|
||||||
break;
|
|
||||||
case ACTION_RECENTS:
|
|
||||||
if (!mKeyguardManager.inKeyguardRestrictedInputMode()) {
|
|
||||||
triggerVirtualKeypress(mHandler, KeyEvent.KEYCODE_APP_SWITCH);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
case ACTION_VOLUME_UP:
|
|
||||||
triggerVirtualKeypress(mHandler, KeyEvent.KEYCODE_VOLUME_UP);
|
|
||||||
break;
|
|
||||||
case ACTION_VOLUME_DOWN:
|
|
||||||
triggerVirtualKeypress(mHandler, KeyEvent.KEYCODE_VOLUME_DOWN);
|
|
||||||
break;
|
|
||||||
case ACTION_VOICE_ASSISTANT:
|
|
||||||
if (!mKeyguardManager.inKeyguardRestrictedInputMode()) {
|
|
||||||
fireGoogleNowOnTap();
|
|
||||||
}
|
|
||||||
return;
|
|
||||||
case ACTION_PLAY_PAUSE:
|
|
||||||
dispatchMediaKeyWithWakeLock(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, mContext);
|
|
||||||
break;
|
|
||||||
case ACTION_PREVIOUS_TRACK:
|
|
||||||
dispatchMediaKeyWithWakeLock(KeyEvent.KEYCODE_MEDIA_PREVIOUS, mContext);
|
|
||||||
break;
|
|
||||||
case ACTION_NEXT_TRACK:
|
|
||||||
dispatchMediaKeyWithWakeLock(KeyEvent.KEYCODE_MEDIA_NEXT, mContext);
|
|
||||||
break;
|
|
||||||
case ACTION_FLASHLIGHT:
|
|
||||||
toggleFlashlight();
|
|
||||||
break;
|
|
||||||
case ACTION_CAMERA:
|
|
||||||
triggerCameraAction();
|
|
||||||
break;
|
|
||||||
case ACTION_SCREENSHOT:
|
|
||||||
triggerVirtualKeypress(mHandler, KeyEvent.KEYCODE_SYSRQ);
|
|
||||||
break;
|
|
||||||
case ACTION_LAST_APP:
|
|
||||||
if (!mKeyguardManager.inKeyguardRestrictedInputMode()) {
|
|
||||||
switchToLastApp(mContext);
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void vibrate(int intensity) {
|
|
||||||
if (mVibrator == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mVibrator.vibrate(intensity);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void toggleScreenState() {
|
|
||||||
if (mPowerManager.isScreenOn()) {
|
|
||||||
mPowerManager.goToSleep(SystemClock.uptimeMillis());
|
|
||||||
} else {
|
|
||||||
mPowerManager.wakeUp(SystemClock.uptimeMillis());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void triggerVirtualKeypress(final Handler handler, final int keyCode) {
|
|
||||||
final InputManager im = InputManager.getInstance();
|
|
||||||
long now = SystemClock.uptimeMillis();
|
|
||||||
|
|
||||||
final KeyEvent downEvent = new KeyEvent(now, now, KeyEvent.ACTION_DOWN,
|
|
||||||
keyCode, 0, 0, KeyCharacterMap.VIRTUAL_KEYBOARD, 0,
|
|
||||||
KeyEvent.FLAG_FROM_SYSTEM, InputDevice.SOURCE_CLASS_BUTTON);
|
|
||||||
final KeyEvent upEvent = KeyEvent.changeAction(downEvent,
|
|
||||||
KeyEvent.ACTION_UP);
|
|
||||||
|
|
||||||
// add a small delay to make sure everything behind got focus
|
|
||||||
handler.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
im.injectInputEvent(downEvent, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
|
|
||||||
}
|
|
||||||
}, 10);
|
|
||||||
|
|
||||||
handler.postDelayed(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
im.injectInputEvent(upEvent, InputManager.INJECT_INPUT_EVENT_MODE_ASYNC);
|
|
||||||
}
|
|
||||||
}, 20);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fireGoogleNowOnTap() {
|
|
||||||
doHapticFeedbackFP(true);
|
|
||||||
mSearchManagerService = ISearchManager.Stub.asInterface(ServiceManager.getService(Context.SEARCH_SERVICE));
|
|
||||||
if (mSearchManagerService != null) {
|
|
||||||
try {
|
|
||||||
mSearchManagerService.launchAssist(mContext.getUserId(), new Bundle());
|
|
||||||
} catch (RemoteException e) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private int str2int(String str) {
|
|
||||||
if (str == null || str.isEmpty()) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
return Integer.valueOf(str);
|
|
||||||
} catch (Exception e) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void processFPScreenOffScancode(int scanCode) {
|
|
||||||
if (!mFPScreenOffGesturesHandler.hasMessages(FP_ACTION_REQUEST)) {
|
|
||||||
Message msg = mFPScreenOffGesturesHandler.obtainMessage(FP_ACTION_REQUEST);
|
|
||||||
msg.arg1 = scanCode;
|
|
||||||
mFPScreenOffGesturesHandler.sendMessage(msg);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void resetFPGestureDelay() {
|
|
||||||
fpGesturePending = false;
|
|
||||||
mHandler.removeCallbacks(fpGestureRunnable);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void fireScreenOffAction(int action) {
|
|
||||||
boolean haptic = Settings.System.getInt(mContext.getContentResolver(), KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK, 1) != 0;
|
|
||||||
if (haptic && (action == ACTION_CAMERA || action == ACTION_FLASHLIGHT)) {
|
|
||||||
vibrate(action == ACTION_CAMERA ? 500 : 250);
|
|
||||||
}
|
|
||||||
if (haptic && action == ACTION_POWER){
|
|
||||||
doHapticFeedbackScreenOff();
|
|
||||||
}
|
|
||||||
switch (action) {
|
|
||||||
case ACTION_POWER:
|
|
||||||
toggleScreenState();
|
|
||||||
break;
|
|
||||||
case ACTION_PLAY_PAUSE:
|
|
||||||
dispatchMediaKeyWithWakeLock(KeyEvent.KEYCODE_MEDIA_PLAY_PAUSE, mContext);
|
|
||||||
break;
|
|
||||||
case ACTION_PREVIOUS_TRACK:
|
|
||||||
dispatchMediaKeyWithWakeLock(KeyEvent.KEYCODE_MEDIA_PREVIOUS, mContext);
|
|
||||||
break;
|
|
||||||
case ACTION_NEXT_TRACK:
|
|
||||||
dispatchMediaKeyWithWakeLock(KeyEvent.KEYCODE_MEDIA_NEXT, mContext);
|
|
||||||
break;
|
|
||||||
case ACTION_FLASHLIGHT:
|
|
||||||
toggleFlashlight();
|
|
||||||
break;
|
|
||||||
case ACTION_CAMERA:
|
|
||||||
triggerCameraAction();
|
|
||||||
break;
|
|
||||||
case ACTION_BROWSER:
|
|
||||||
openBrowser();
|
|
||||||
break;
|
|
||||||
case ACTION_DIALER:
|
|
||||||
openDialer();
|
|
||||||
break;
|
|
||||||
case ACTION_EMAIL:
|
|
||||||
openEmail();
|
|
||||||
break;
|
|
||||||
case ACTION_MESSAGES:
|
|
||||||
openMessages();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (action != ACTION_FLASHLIGHT && action != ACTION_CAMERA && action != ACTION_POWER) {
|
|
||||||
doHapticFeedbackScreenOff();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void startActivitySafely(Intent intent) {
|
|
||||||
intent.addFlags(
|
|
||||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
|
||||||
| Intent.FLAG_ACTIVITY_SINGLE_TOP
|
|
||||||
| Intent.FLAG_ACTIVITY_CLEAR_TOP);
|
|
||||||
try {
|
|
||||||
UserHandle user = new UserHandle(UserHandle.USER_CURRENT);
|
|
||||||
mContext.startActivityAsUser(intent, null, user);
|
|
||||||
} catch (ActivityNotFoundException e) {
|
|
||||||
// Ignore
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doHapticFeedbackScreenOff() {
|
|
||||||
if (mVibrator == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
boolean enabled = Settings.System.getInt(mContext.getContentResolver(), KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK, 1) != 0;
|
|
||||||
if (enabled) {
|
|
||||||
mVibrator.vibrate(50);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doHapticFeedbackFP(boolean longpress) {
|
|
||||||
if (mVibrator == null) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (isHapticFeedbackEnabledOnFP()) {
|
|
||||||
mHandler.post(new Runnable() {
|
|
||||||
public void run() {
|
|
||||||
int owningUid;
|
|
||||||
String owningPackage;
|
|
||||||
owningUid = android.os.Process.myUid();
|
|
||||||
owningPackage = mContext.getOpPackageName();
|
|
||||||
VibrationEffect effect = VibrationEffect.createOneShot(longpress ? 50 : 40, VibrationEffect.DEFAULT_AMPLITUDE);
|
|
||||||
mVibrator.vibrate(owningUid, owningPackage, effect, null, VIBRATION_ATTRIBUTES);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class FPScreenOffGesturesHandler extends Handler {
|
|
||||||
@Override
|
|
||||||
public void handleMessage(Message msg) {
|
|
||||||
processFPScancode(msg.arg1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MyTorchCallback extends CameraManager.TorchCallback {
|
|
||||||
@Override
|
|
||||||
public void onTorchModeChanged(String cameraId, boolean enabled) {
|
|
||||||
if (!cameraId.equals(mRearCameraId))
|
|
||||||
return;
|
|
||||||
mTorchEnabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTorchModeUnavailable(String cameraId) {
|
|
||||||
if (!cameraId.equals(mRearCameraId))
|
|
||||||
return;
|
|
||||||
mTorchEnabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,92 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
import android.database.Cursor;
|
|
||||||
import android.database.MatrixCursor;
|
|
||||||
import android.provider.SearchIndexableResource;
|
|
||||||
import android.provider.SearchIndexablesProvider;
|
|
||||||
|
|
||||||
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_CLASS_NAME;
|
|
||||||
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_ICON_RESID;
|
|
||||||
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_ACTION;
|
|
||||||
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_CLASS;
|
|
||||||
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE;
|
|
||||||
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RANK;
|
|
||||||
import static android.provider.SearchIndexablesContract.COLUMN_INDEX_XML_RES_RESID;
|
|
||||||
import static android.provider.SearchIndexablesContract.INDEXABLES_RAW_COLUMNS;
|
|
||||||
import static android.provider.SearchIndexablesContract.INDEXABLES_XML_RES_COLUMNS;
|
|
||||||
import static android.provider.SearchIndexablesContract.NON_INDEXABLES_KEYS_COLUMNS;
|
|
||||||
|
|
||||||
public class MotoActionsSearchIndexablesProvider extends SearchIndexablesProvider {
|
|
||||||
private static final String TAG = "MotoActionsSearchIndexablesProvider";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onCreate() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Cursor queryXmlResources(String[] projection) {
|
|
||||||
MatrixCursor cursor = new MatrixCursor(INDEXABLES_XML_RES_COLUMNS);
|
|
||||||
|
|
||||||
cursor.addRow(generateResourceRef(new SearchIndexableResource(1, R.xml.actions_panel,
|
|
||||||
GestureSettingsActivity.class.getName(),
|
|
||||||
R.drawable.ic_settings_gestures)));
|
|
||||||
|
|
||||||
cursor.addRow(generateResourceRef(new SearchIndexableResource(1, R.xml.fp_gesture_panel,
|
|
||||||
FPGestureSettingsActivity.class.getName(),
|
|
||||||
R.drawable.ic_settings_fingerprint)));
|
|
||||||
cursor.addRow(generateResourceRef(new SearchIndexableResource(1, R.xml.fp_gesture_panel_indexable,
|
|
||||||
FPGestureSettingsActivity.class.getName(),
|
|
||||||
R.drawable.ic_settings_fingerprint)));
|
|
||||||
|
|
||||||
cursor.addRow(generateResourceRef(new SearchIndexableResource(1, R.xml.doze_panel,
|
|
||||||
DozeSettingsActivity.class.getName(),
|
|
||||||
R.drawable.ic_settings_doze)));
|
|
||||||
cursor.addRow(generateResourceRef(new SearchIndexableResource(1, R.xml.doze_panel_indexable,
|
|
||||||
DozeSettingsActivity.class.getName(),
|
|
||||||
R.drawable.ic_settings_doze)));
|
|
||||||
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static Object[] generateResourceRef(SearchIndexableResource sir) {
|
|
||||||
Object[] ref = new Object[7];
|
|
||||||
ref[COLUMN_INDEX_XML_RES_RANK] = sir.rank;
|
|
||||||
ref[COLUMN_INDEX_XML_RES_RESID] = sir.xmlResId;
|
|
||||||
ref[COLUMN_INDEX_XML_RES_CLASS_NAME] = null;
|
|
||||||
ref[COLUMN_INDEX_XML_RES_ICON_RESID] = sir.iconResId;
|
|
||||||
ref[COLUMN_INDEX_XML_RES_INTENT_ACTION] = "com.android.settings.action.EXTRA_SETTINGS";
|
|
||||||
ref[COLUMN_INDEX_XML_RES_INTENT_TARGET_PACKAGE] = "com.moto.actions";
|
|
||||||
ref[COLUMN_INDEX_XML_RES_INTENT_TARGET_CLASS] = sir.className;
|
|
||||||
return ref;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Cursor queryRawData(String[] projection) {
|
|
||||||
MatrixCursor cursor = new MatrixCursor(INDEXABLES_RAW_COLUMNS);
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Cursor queryNonIndexableKeys(String[] projection) {
|
|
||||||
MatrixCursor cursor = new MatrixCursor(NON_INDEXABLES_KEYS_COLUMNS);
|
|
||||||
return cursor;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,115 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
import android.app.IntentService;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.PowerManager;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.LinkedList;
|
|
||||||
|
|
||||||
import com.moto.actions.actions.UpdatedStateNotifier;
|
|
||||||
import com.moto.actions.actions.CameraActivationSensor;
|
|
||||||
import com.moto.actions.actions.ChopChopSensor;
|
|
||||||
import com.moto.actions.actions.FlipToMute;
|
|
||||||
import com.moto.actions.actions.LiftToSilence;
|
|
||||||
import com.moto.actions.actions.ProximitySilencer;
|
|
||||||
|
|
||||||
import com.moto.actions.doze.DozePulseAction;
|
|
||||||
import com.moto.actions.doze.GlanceSensor;
|
|
||||||
import com.moto.actions.doze.ProximitySensor;
|
|
||||||
import com.moto.actions.doze.ScreenReceiver;
|
|
||||||
import com.moto.actions.doze.ScreenStateNotifier;
|
|
||||||
|
|
||||||
public class MotoActionsService extends IntentService implements ScreenStateNotifier,
|
|
||||||
UpdatedStateNotifier {
|
|
||||||
private static final String TAG = "MotoActions";
|
|
||||||
|
|
||||||
private final PowerManager mPowerManager;
|
|
||||||
private final PowerManager.WakeLock mWakeLock;
|
|
||||||
|
|
||||||
private final List<ScreenStateNotifier> mScreenStateNotifiers = new LinkedList<>();
|
|
||||||
private final List<UpdatedStateNotifier> mUpdatedStateNotifiers = new LinkedList<>();
|
|
||||||
|
|
||||||
public MotoActionsService(Context context) {
|
|
||||||
super("MotoActionService");
|
|
||||||
|
|
||||||
Log.d(TAG, "Starting");
|
|
||||||
|
|
||||||
MotoActionsSettings motoActionsSettings = new MotoActionsSettings(context, this);
|
|
||||||
SensorHelper sensorHelper = new SensorHelper(context);
|
|
||||||
new ScreenReceiver(context, this);
|
|
||||||
|
|
||||||
DozePulseAction mDozePulseAction = new DozePulseAction(context);
|
|
||||||
mScreenStateNotifiers.add(mDozePulseAction);
|
|
||||||
|
|
||||||
// Actionable sensors get screen on/off notifications
|
|
||||||
mScreenStateNotifiers.add(new GlanceSensor(motoActionsSettings, sensorHelper, mDozePulseAction));
|
|
||||||
mScreenStateNotifiers.add(new ProximitySensor(motoActionsSettings, sensorHelper, mDozePulseAction));
|
|
||||||
|
|
||||||
// Other actions that are always enabled
|
|
||||||
mUpdatedStateNotifiers.add(new CameraActivationSensor(motoActionsSettings, sensorHelper));
|
|
||||||
mUpdatedStateNotifiers.add(new ChopChopSensor(motoActionsSettings, sensorHelper));
|
|
||||||
mUpdatedStateNotifiers.add(new ProximitySilencer(motoActionsSettings, context, sensorHelper));
|
|
||||||
mUpdatedStateNotifiers.add(new FlipToMute(motoActionsSettings, context, sensorHelper));
|
|
||||||
mUpdatedStateNotifiers.add(new LiftToSilence(motoActionsSettings, context, sensorHelper));
|
|
||||||
|
|
||||||
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
|
||||||
String tag = context.getPackageName() + ":ServiceWakeLock";
|
|
||||||
mWakeLock = mPowerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, tag);
|
|
||||||
updateState();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
protected void onHandleIntent(Intent intent) {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void screenTurnedOn() {
|
|
||||||
if (!mWakeLock.isHeld()) {
|
|
||||||
mWakeLock.acquire();
|
|
||||||
}
|
|
||||||
for (ScreenStateNotifier screenStateNotifier : mScreenStateNotifiers) {
|
|
||||||
screenStateNotifier.screenTurnedOn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void screenTurnedOff() {
|
|
||||||
if (mWakeLock.isHeld()) {
|
|
||||||
mWakeLock.release();
|
|
||||||
}
|
|
||||||
for (ScreenStateNotifier screenStateNotifier : mScreenStateNotifiers) {
|
|
||||||
screenStateNotifier.screenTurnedOff();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateState() {
|
|
||||||
if (mPowerManager.isInteractive()) {
|
|
||||||
screenTurnedOn();
|
|
||||||
} else {
|
|
||||||
screenTurnedOff();
|
|
||||||
}
|
|
||||||
for (UpdatedStateNotifier notifier : mUpdatedStateNotifiers) {
|
|
||||||
notifier.updateState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,147 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.provider.Settings;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.actions.Constants;
|
|
||||||
import com.moto.actions.actions.UpdatedStateNotifier;
|
|
||||||
import com.moto.actions.actions.CameraActivationAction;
|
|
||||||
import com.moto.actions.actions.TorchAction;
|
|
||||||
|
|
||||||
public class MotoActionsSettings implements SharedPreferences.OnSharedPreferenceChangeListener {
|
|
||||||
private static final String TAG = "MotoActions";
|
|
||||||
|
|
||||||
private static final String GESTURE_CAMERA_ACTION_KEY = "gesture_camera_action";
|
|
||||||
private static final String GESTURE_CHOP_CHOP_KEY = "gesture_chop_chop";
|
|
||||||
private static final String GESTURE_PICK_UP_KEY = "gesture_pick_up";
|
|
||||||
private static final String GESTURE_IR_WAKEUP_KEY = "gesture_hand_wave";
|
|
||||||
private static final String GESTURE_IR_SILENCER_KEY = "gesture_ir_silencer";
|
|
||||||
private static final String GESTURE_FLIP_TO_MUTE_KEY = "gesture_flip_to_mute";
|
|
||||||
private static final String GESTURE_LIFT_TO_SILENCE_KEY = "gesture_lift_to_silence";
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
private final UpdatedStateNotifier mUpdatedStateNotifier;
|
|
||||||
|
|
||||||
private boolean mCameraGestureEnabled;
|
|
||||||
private boolean mChopChopEnabled;
|
|
||||||
private boolean mPickUpGestureEnabled;
|
|
||||||
private boolean mIrWakeUpEnabled;
|
|
||||||
private boolean mIrSilencerEnabled;
|
|
||||||
private boolean mFlipToMuteEnabled;
|
|
||||||
private boolean mLiftToSilenceEnabled;
|
|
||||||
|
|
||||||
public MotoActionsSettings(Context context, UpdatedStateNotifier updatedStateNotifier) {
|
|
||||||
SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
loadPreferences(sharedPrefs);
|
|
||||||
sharedPrefs.registerOnSharedPreferenceChangeListener(this);
|
|
||||||
mContext = context;
|
|
||||||
mUpdatedStateNotifier = updatedStateNotifier;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isCameraGestureEnabled() {
|
|
||||||
return mCameraGestureEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isChopChopGestureEnabled() {
|
|
||||||
return mChopChopEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isDozeEnabled(ContentResolver contentResolver) {
|
|
||||||
return (Settings.Secure.getInt(contentResolver, Settings.Secure.DOZE_ENABLED, 1) != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isDozeEnabled() {
|
|
||||||
return isDozeEnabled(mContext.getContentResolver());
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isIrWakeupEnabled() {
|
|
||||||
return isDozeEnabled() && mIrWakeUpEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isPickUpEnabled() {
|
|
||||||
return isDozeEnabled() && mPickUpGestureEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isIrSilencerEnabled() {
|
|
||||||
return mIrSilencerEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isFlipToMuteEnabled() {
|
|
||||||
return mFlipToMuteEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean isLiftToSilenceEnabled() {
|
|
||||||
return mLiftToSilenceEnabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void cameraAction() {
|
|
||||||
new CameraActivationAction(mContext).action();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void chopChopAction() {
|
|
||||||
new TorchAction(mContext).action();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void loadPreferences(SharedPreferences sharedPreferences) {
|
|
||||||
mCameraGestureEnabled = sharedPreferences.getBoolean(GESTURE_CAMERA_ACTION_KEY, true);
|
|
||||||
mChopChopEnabled = sharedPreferences.getBoolean(GESTURE_CHOP_CHOP_KEY, true);
|
|
||||||
mIrWakeUpEnabled = sharedPreferences.getBoolean(GESTURE_IR_WAKEUP_KEY, false);
|
|
||||||
mPickUpGestureEnabled = sharedPreferences.getBoolean(GESTURE_PICK_UP_KEY, true);
|
|
||||||
mIrSilencerEnabled = sharedPreferences.getBoolean(GESTURE_IR_SILENCER_KEY, false);
|
|
||||||
mFlipToMuteEnabled = sharedPreferences.getBoolean(GESTURE_FLIP_TO_MUTE_KEY, false);
|
|
||||||
mLiftToSilenceEnabled = sharedPreferences.getBoolean(GESTURE_LIFT_TO_SILENCE_KEY, false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSharedPreferenceChanged(SharedPreferences sharedPreferences, String key) {
|
|
||||||
boolean updated = true;
|
|
||||||
|
|
||||||
if (GESTURE_CAMERA_ACTION_KEY.equals(key)) {
|
|
||||||
mCameraGestureEnabled = sharedPreferences.getBoolean(GESTURE_CAMERA_ACTION_KEY, true);
|
|
||||||
} else if (GESTURE_CHOP_CHOP_KEY.equals(key)) {
|
|
||||||
mChopChopEnabled = sharedPreferences.getBoolean(GESTURE_CHOP_CHOP_KEY, true);
|
|
||||||
} else if (GESTURE_IR_WAKEUP_KEY.equals(key)) {
|
|
||||||
mIrWakeUpEnabled = sharedPreferences.getBoolean(GESTURE_IR_WAKEUP_KEY, false);
|
|
||||||
} else if (GESTURE_PICK_UP_KEY.equals(key)) {
|
|
||||||
mPickUpGestureEnabled = sharedPreferences.getBoolean(GESTURE_PICK_UP_KEY, true);
|
|
||||||
} else if (GESTURE_IR_SILENCER_KEY.equals(key)) {
|
|
||||||
mIrSilencerEnabled = sharedPreferences.getBoolean(GESTURE_IR_SILENCER_KEY, false);
|
|
||||||
} else if (GESTURE_FLIP_TO_MUTE_KEY.equals(key)) {
|
|
||||||
mFlipToMuteEnabled = sharedPreferences.getBoolean(GESTURE_FLIP_TO_MUTE_KEY, false);
|
|
||||||
} else if (GESTURE_LIFT_TO_SILENCE_KEY.equals(key)) {
|
|
||||||
mLiftToSilenceEnabled = sharedPreferences.getBoolean(GESTURE_LIFT_TO_SILENCE_KEY, false);
|
|
||||||
} else if (Constants.FP_HOME_KEY.equals(key) || Constants.FP_HAPTIC_KEY.equals(key) || Constants.FP_HOME_KEY_OFF.equals(key) || Constants.FP_HAPTIC_SCREENOFF_KEY.equals(key) || Constants.FP_KEYS.equals(key) || Constants.FP_KEY_DBLTAP.equals(key) || Constants.FP_KEY_HOLD.equals(key) || Constants.FP_KEY_LEFT.equals(key) || Constants.FP_KEY_RIGHT.equals(key)
|
|
||||||
|| Constants.FP_KEYS_OFF.equals(key) || Constants.FP_KEY_DBLTAP_OFF.equals(key) || Constants.FP_KEY_HOLD_OFF.equals(key) || Constants.FP_KEY_LEFT_OFF.equals(key) || Constants.FP_KEY_RIGHT_OFF.equals(key)) {
|
|
||||||
Constants.writePreference(mContext, key);
|
|
||||||
updated = false;
|
|
||||||
} else {
|
|
||||||
updated = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (updated) {
|
|
||||||
mUpdatedStateNotifier.updateState();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
public interface SensorAction {
|
|
||||||
void action();
|
|
||||||
}
|
|
||||||
@@ -1,105 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import java.io.FileOutputStream;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.io.OutputStreamWriter;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.hardware.SensorManager;
|
|
||||||
|
|
||||||
public class SensorHelper {
|
|
||||||
private static final String TAG = "MotoActions";
|
|
||||||
|
|
||||||
private static final int SENSOR_TYPE_MMI_CAMERA_ACTIVATION = 65540;
|
|
||||||
private static final int SENSOR_TYPE_MMI_CHOP_CHOP = 65546;
|
|
||||||
private static final int SENSOR_TYPE_MMI_FLAT_UP = 65537;
|
|
||||||
private static final int SENSOR_TYPE_MMI_FLAT_DOWN = 65538;
|
|
||||||
private static final int SENSOR_TYPE_MMI_STOW = 65539;
|
|
||||||
private static final int SENSOR_TYPE_MMI_GLANCE = 65548;
|
|
||||||
|
|
||||||
private static final int BATCH_LATENCY_IN_MS = 100;
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
private final SensorManager mSensorManager;
|
|
||||||
|
|
||||||
public SensorHelper(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
mSensorManager = (SensorManager) mContext.getSystemService(Context.SENSOR_SERVICE);
|
|
||||||
dumpSensorsList();
|
|
||||||
}
|
|
||||||
|
|
||||||
private void dumpSensorsList() {
|
|
||||||
try {
|
|
||||||
FileOutputStream out = mContext.openFileOutput("sensors.txt", Context.MODE_PRIVATE);
|
|
||||||
OutputStreamWriter writer = new OutputStreamWriter(out);
|
|
||||||
|
|
||||||
List<Sensor> sensorList = mSensorManager.getSensorList(Sensor.TYPE_ALL);
|
|
||||||
for (Sensor sensor : sensorList) {
|
|
||||||
writer.write("sensor " + sensor.getType() + " = " + sensor.getName()
|
|
||||||
+ " max batch: " + sensor.getFifoMaxEventCount() + " isWakeUp: " + sensor.isWakeUpSensor() + "\n");
|
|
||||||
}
|
|
||||||
writer.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
throw new RuntimeException(e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sensor getCameraActivationSensor() {
|
|
||||||
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_CAMERA_ACTIVATION, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sensor getChopChopSensor() {
|
|
||||||
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_CHOP_CHOP, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sensor getFlatUpSensor() {
|
|
||||||
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_FLAT_UP, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sensor getFlatDownSensor() {
|
|
||||||
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_FLAT_DOWN, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sensor getGlanceSensor() {
|
|
||||||
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_GLANCE, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sensor getProximitySensor() {
|
|
||||||
return mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Sensor getStowSensor() {
|
|
||||||
return mSensorManager.getDefaultSensor(SENSOR_TYPE_MMI_STOW, true);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void registerListener(Sensor sensor, SensorEventListener listener) {
|
|
||||||
if (!mSensorManager.registerListener(listener, sensor,
|
|
||||||
SensorManager.SENSOR_DELAY_NORMAL, BATCH_LATENCY_IN_MS * 1000)) {
|
|
||||||
throw new RuntimeException("Failed to registerListener for sensor " + sensor);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public void unregisterListener(SensorEventListener listener) {
|
|
||||||
mSensorManager.unregisterListener(listener);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions;
|
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.Binder;
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class ServiceWrapper extends android.app.Service {
|
|
||||||
static final String TAG = "MotoActions-ServiceWrapper";
|
|
||||||
|
|
||||||
private final IBinder mBinder = new LocalBinder();
|
|
||||||
private MotoActionsService mMotoActionsService;
|
|
||||||
|
|
||||||
public interface ServiceCallback {
|
|
||||||
void sendResults(int resultCode, Bundle b);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class LocalBinder extends Binder {
|
|
||||||
ServiceWrapper getService() {
|
|
||||||
// Return this instance of the service so clients can call public
|
|
||||||
// methods
|
|
||||||
return ServiceWrapper.this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onCreate() {
|
|
||||||
Log.i(TAG, "onCreate");
|
|
||||||
super.onCreate();
|
|
||||||
mMotoActionsService = new MotoActionsService(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
Log.i(TAG, "onBind");
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCallback(ServiceCallback callback) {
|
|
||||||
}
|
|
||||||
|
|
||||||
public void start() {
|
|
||||||
Log.i(TAG, "start");
|
|
||||||
}
|
|
||||||
|
|
||||||
public void stop() {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,138 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.actions;
|
|
||||||
|
|
||||||
import android.app.KeyguardManager;
|
|
||||||
import android.content.ComponentName;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.pm.ActivityInfo;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.pm.ResolveInfo;
|
|
||||||
import android.os.PowerManager;
|
|
||||||
import android.os.PowerManager.WakeLock;
|
|
||||||
import android.os.VibrationEffect;
|
|
||||||
import android.os.Vibrator;
|
|
||||||
import android.provider.MediaStore;
|
|
||||||
|
|
||||||
import com.moto.actions.SensorAction;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public class CameraActivationAction implements SensorAction {
|
|
||||||
private static final String TAG = "MotoActions";
|
|
||||||
|
|
||||||
private static final int TURN_SCREEN_ON_WAKE_LOCK_MS = 500;
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
private final KeyguardManager mKeyguardManager;
|
|
||||||
private final PackageManager mPackageManager;
|
|
||||||
private final PowerManager mPowerManager;
|
|
||||||
|
|
||||||
public CameraActivationAction(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
mKeyguardManager = (KeyguardManager) context.getSystemService(Context.KEYGUARD_SERVICE);
|
|
||||||
mPowerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
|
||||||
mPackageManager = context.getPackageManager();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void action() {
|
|
||||||
vibrate();
|
|
||||||
turnScreenOn();
|
|
||||||
if (mKeyguardManager.isKeyguardLocked()) {
|
|
||||||
launchSecureCamera();
|
|
||||||
} else {
|
|
||||||
launchCamera();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void vibrate() {
|
|
||||||
Vibrator vib = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
|
|
||||||
if (vib == null) return;
|
|
||||||
VibrationEffect effect = VibrationEffect.createOneShot(500, VibrationEffect.DEFAULT_AMPLITUDE);
|
|
||||||
vib.vibrate(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void turnScreenOn() {
|
|
||||||
String tag = mContext.getPackageName() + ":CameraWakeLock";
|
|
||||||
WakeLock wl = mPowerManager.newWakeLock(
|
|
||||||
PowerManager.SCREEN_BRIGHT_WAKE_LOCK | PowerManager.ACQUIRE_CAUSES_WAKEUP, tag);
|
|
||||||
wl.acquire(TURN_SCREEN_ON_WAKE_LOCK_MS);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void launchCamera() {
|
|
||||||
Intent intent = createIntent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
|
|
||||||
if (getBestActivityInfo(intent) != null) {
|
|
||||||
// Only launch if we can succeed, but let the user pick the action
|
|
||||||
mContext.startActivity(intent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void launchSecureCamera() {
|
|
||||||
// Keyguard won't allow a picker, try to pick the secure intent in the package
|
|
||||||
// that would be the one used for a default action of launching the camera
|
|
||||||
Intent normalIntent = createIntent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA);
|
|
||||||
Intent secureIntent = createIntent(MediaStore.INTENT_ACTION_STILL_IMAGE_CAMERA_SECURE);
|
|
||||||
ActivityInfo normalActivity = getBestActivityInfo(normalIntent);
|
|
||||||
ActivityInfo secureActivity = getBestActivityInfo(secureIntent, normalActivity);
|
|
||||||
if (secureActivity != null) {
|
|
||||||
secureIntent.setComponent(componentName(secureActivity));
|
|
||||||
mContext.startActivity(secureIntent);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private Intent createIntent(String intentName) {
|
|
||||||
Intent intent = new Intent(intentName);
|
|
||||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
|
||||||
intent.addFlags(Intent.FLAG_FROM_BACKGROUND);
|
|
||||||
return intent;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ActivityInfo getBestActivityInfo(Intent intent) {
|
|
||||||
ResolveInfo resolveInfo = mPackageManager.resolveActivity(intent, 0);
|
|
||||||
if (resolveInfo != null) {
|
|
||||||
return resolveInfo.activityInfo;
|
|
||||||
} else {
|
|
||||||
// If the resolving failed, just find our own best match
|
|
||||||
return getBestActivityInfo(intent, null);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private ActivityInfo getBestActivityInfo(Intent intent, ActivityInfo match) {
|
|
||||||
List <ResolveInfo> activities = mPackageManager.queryIntentActivities(intent, 0);
|
|
||||||
ActivityInfo best = null;
|
|
||||||
if (activities.size() > 0) {
|
|
||||||
best = activities.get(0).activityInfo;
|
|
||||||
if (match != null) {
|
|
||||||
String packageName = match.applicationInfo.packageName;
|
|
||||||
for (int i = activities.size()-1; i >= 0; i--) {
|
|
||||||
ActivityInfo activityInfo = activities.get(i).activityInfo;
|
|
||||||
if (packageName.equals(activityInfo.applicationInfo.packageName)) {
|
|
||||||
best = activityInfo;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return best;
|
|
||||||
}
|
|
||||||
|
|
||||||
private ComponentName componentName(ActivityInfo activity) {
|
|
||||||
return new ComponentName(activity.applicationInfo.packageName, activity.name);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,61 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.actions;
|
|
||||||
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.MotoActionsSettings;
|
|
||||||
import com.moto.actions.SensorHelper;
|
|
||||||
|
|
||||||
public class CameraActivationSensor implements SensorEventListener, UpdatedStateNotifier {
|
|
||||||
private static final String TAG = "MotoActions-CameraSensor";
|
|
||||||
|
|
||||||
private final MotoActionsSettings mMotoActionsSettings;
|
|
||||||
|
|
||||||
private boolean mIsEnabled;
|
|
||||||
|
|
||||||
public CameraActivationSensor(MotoActionsSettings motoActionsSettings, SensorHelper sensorHelper) {
|
|
||||||
mMotoActionsSettings = motoActionsSettings;
|
|
||||||
Sensor sensor = sensorHelper.getCameraActivationSensor();
|
|
||||||
sensorHelper.registerListener(sensor, this);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void updateState() {
|
|
||||||
if (mMotoActionsSettings.isCameraGestureEnabled() && !mIsEnabled) {
|
|
||||||
Log.d(TAG, "Enabling");
|
|
||||||
mIsEnabled = true;
|
|
||||||
} else if (! mMotoActionsSettings.isCameraGestureEnabled() && mIsEnabled) {
|
|
||||||
Log.d(TAG, "Disabling");
|
|
||||||
mIsEnabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSensorChanged(SensorEvent event) {
|
|
||||||
Log.d(TAG, "activate camera");
|
|
||||||
if (mIsEnabled) mMotoActionsSettings.cameraAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,86 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015-2016 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.actions;
|
|
||||||
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.MotoActionsSettings;
|
|
||||||
import com.moto.actions.SensorHelper;
|
|
||||||
|
|
||||||
public class ChopChopSensor implements SensorEventListener, UpdatedStateNotifier {
|
|
||||||
private static final String TAG = "MotoActions-ChopChopSensor";
|
|
||||||
|
|
||||||
private final MotoActionsSettings mMotoActionsSettings;
|
|
||||||
private final SensorHelper mSensorHelper;
|
|
||||||
private final Sensor mSensor;
|
|
||||||
private final Sensor mProx;
|
|
||||||
|
|
||||||
private boolean mIsEnabled;
|
|
||||||
private boolean mProxIsCovered;
|
|
||||||
|
|
||||||
public ChopChopSensor(MotoActionsSettings motoActionsSettings, SensorHelper sensorHelper) {
|
|
||||||
mMotoActionsSettings = motoActionsSettings;
|
|
||||||
mSensorHelper = sensorHelper;
|
|
||||||
mSensor = sensorHelper.getChopChopSensor();
|
|
||||||
mProx = sensorHelper.getProximitySensor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void updateState() {
|
|
||||||
if (mMotoActionsSettings.isChopChopGestureEnabled() && !mIsEnabled) {
|
|
||||||
Log.d(TAG, "Enabling");
|
|
||||||
mSensorHelper.registerListener(mSensor, this);
|
|
||||||
mSensorHelper.registerListener(mProx, mProxListener);
|
|
||||||
mIsEnabled = true;
|
|
||||||
} else if (! mMotoActionsSettings.isChopChopGestureEnabled() && mIsEnabled) {
|
|
||||||
Log.d(TAG, "Disabling");
|
|
||||||
mSensorHelper.unregisterListener(this);
|
|
||||||
mSensorHelper.unregisterListener(mProxListener);
|
|
||||||
mIsEnabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSensorChanged(SensorEvent event) {
|
|
||||||
Log.d(TAG, "chop chop triggered");
|
|
||||||
if (mProxIsCovered) {
|
|
||||||
Log.d(TAG, "proximity sensor covered, ignoring chop-chop");
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
mMotoActionsSettings.chopChopAction();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor sensor, int accuracy) {
|
|
||||||
}
|
|
||||||
|
|
||||||
private SensorEventListener mProxListener = new SensorEventListener() {
|
|
||||||
@Override
|
|
||||||
public synchronized void onSensorChanged(SensorEvent event) {
|
|
||||||
mProxIsCovered = event.values[0] < mProx.getMaximumRange();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor mSensor, int accuracy) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,219 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 The CyanogenMod Project
|
|
||||||
* Copyright (C) 2017 The LineageOS 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.moto.actions.actions;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.SharedPreferences;
|
|
||||||
import android.preference.PreferenceManager;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.util.FileUtils;
|
|
||||||
|
|
||||||
public class Constants {
|
|
||||||
|
|
||||||
public static final boolean DEBUG = false;
|
|
||||||
|
|
||||||
private static final String TAG = "MotoActions";
|
|
||||||
|
|
||||||
// FP gestures
|
|
||||||
public static final int FP_TAP_SCANCODE = 616;
|
|
||||||
public static final int FP_HOLD_SCANCODE = 617;
|
|
||||||
public static final int FP_RIGHT_SCANCODE = 620;
|
|
||||||
public static final int FP_LEFT_SCANCODE = 621;
|
|
||||||
public static final int[] sSupportedFPGestures = new int[]{
|
|
||||||
FP_TAP_SCANCODE,
|
|
||||||
FP_HOLD_SCANCODE,
|
|
||||||
FP_RIGHT_SCANCODE,
|
|
||||||
FP_LEFT_SCANCODE
|
|
||||||
};
|
|
||||||
|
|
||||||
// FP actions
|
|
||||||
public static final int ACTION_HOME = 100;
|
|
||||||
public static final int ACTION_POWER = 101;
|
|
||||||
public static final int ACTION_BACK = 102;
|
|
||||||
public static final int ACTION_RECENTS = 103;
|
|
||||||
public static final int ACTION_VOLUME_UP = 104;
|
|
||||||
public static final int ACTION_VOLUME_DOWN = 105;
|
|
||||||
public static final int ACTION_VOICE_ASSISTANT = 106;
|
|
||||||
public static final int ACTION_PLAY_PAUSE = 107;
|
|
||||||
public static final int ACTION_PREVIOUS_TRACK = 108;
|
|
||||||
public static final int ACTION_NEXT_TRACK = 109;
|
|
||||||
public static final int ACTION_FLASHLIGHT = 110;
|
|
||||||
public static final int ACTION_CAMERA = 111;
|
|
||||||
public static final int ACTION_SCREENSHOT = 112;
|
|
||||||
public static final int ACTION_BROWSER = 116;
|
|
||||||
public static final int ACTION_DIALER = 117;
|
|
||||||
public static final int ACTION_EMAIL = 118;
|
|
||||||
public static final int ACTION_MESSAGES = 119;
|
|
||||||
public static final int ACTION_LAST_APP = 121;
|
|
||||||
public static final int[] sFPSupportedActions = new int[]{
|
|
||||||
ACTION_HOME,
|
|
||||||
ACTION_POWER,
|
|
||||||
ACTION_BACK,
|
|
||||||
ACTION_RECENTS,
|
|
||||||
ACTION_VOLUME_UP,
|
|
||||||
ACTION_VOLUME_DOWN,
|
|
||||||
ACTION_VOICE_ASSISTANT,
|
|
||||||
ACTION_PLAY_PAUSE,
|
|
||||||
ACTION_PREVIOUS_TRACK,
|
|
||||||
ACTION_NEXT_TRACK,
|
|
||||||
ACTION_FLASHLIGHT,
|
|
||||||
ACTION_CAMERA,
|
|
||||||
ACTION_SCREENSHOT,
|
|
||||||
ACTION_LAST_APP
|
|
||||||
};
|
|
||||||
public static final int[] sFPSupportedActionsScreenOff = new int[]{
|
|
||||||
ACTION_POWER,
|
|
||||||
ACTION_VOLUME_UP,
|
|
||||||
ACTION_VOLUME_DOWN,
|
|
||||||
ACTION_PLAY_PAUSE,
|
|
||||||
ACTION_PREVIOUS_TRACK,
|
|
||||||
ACTION_NEXT_TRACK,
|
|
||||||
ACTION_FLASHLIGHT,
|
|
||||||
ACTION_CAMERA
|
|
||||||
};
|
|
||||||
|
|
||||||
// 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";
|
|
||||||
public static final String FP_HAPTIC_KEY = "fp_haptic";
|
|
||||||
public static final String FP_HAPTIC_SCREENOFF_NODE = "/sys/homebutton/haptic_off";
|
|
||||||
public static final String FP_HAPTIC_SCREENOFF_KEY = "fp_haptic_scr_off";
|
|
||||||
|
|
||||||
// List of keys
|
|
||||||
public static final String FP_KEYS = "fp_keys";
|
|
||||||
public static final String FP_KEY_DBLTAP = "fp_key_dbltap";
|
|
||||||
public static final String FP_KEY_HOLD = "fp_key_hold";
|
|
||||||
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_DBLTAP_OFF = "fp_key_dbltap_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_DBLTAP_NODE = "/sys/homebutton/key_dbltap";
|
|
||||||
public static final String FP_KEY_HOLD_NODE = "/sys/homebutton/key_hold";
|
|
||||||
public static final String FP_KEY_LEFT_NODE = "/sys/homebutton/key_left";
|
|
||||||
public static final String FP_KEY_RIGHT_NODE = "/sys/homebutton/key_right";
|
|
||||||
|
|
||||||
public static final String FP_KEYS_SCREENOFF_NODE = "/sys/homebutton/key_screenoff";
|
|
||||||
public static final String FP_KEY_SCREENOFF_DBLTAP_NODE = "/sys/homebutton/key_screenoff_dbltap";
|
|
||||||
public static final String FP_KEY_SCREENOFF_HOLD_NODE = "/sys/homebutton/key_screenoff_hold";
|
|
||||||
public static final String FP_KEY_SCREENOFF_LEFT_NODE = "/sys/homebutton/key_screenoff_left";
|
|
||||||
public static final String FP_KEY_SCREENOFF_RIGHT_NODE = "/sys/homebutton/key_screenoff_right";
|
|
||||||
|
|
||||||
// Screen off gestures haptic
|
|
||||||
public static final String KEY_GESTURE_ENABLE_HAPTIC_FEEDBACK = "screen_off_gesture_haptic_feedback";
|
|
||||||
|
|
||||||
// Holds <preference_key> -> <proc_node> mapping
|
|
||||||
public static final Map<String, String> sBooleanNodePreferenceMap = new HashMap<>();
|
|
||||||
|
|
||||||
// Holds <preference_key> -> <default_values> mapping
|
|
||||||
public static final Map<String, Object> sNodeDefaultMap = new HashMap<>();
|
|
||||||
|
|
||||||
public static final String[] sPrefKeys = {
|
|
||||||
FP_HOME_KEY,
|
|
||||||
FP_HOME_KEY_OFF,
|
|
||||||
FP_HAPTIC_KEY,
|
|
||||||
FP_HAPTIC_SCREENOFF_KEY,
|
|
||||||
FP_KEYS,
|
|
||||||
FP_KEY_DBLTAP,
|
|
||||||
FP_KEY_HOLD,
|
|
||||||
FP_KEY_RIGHT,
|
|
||||||
FP_KEY_LEFT,
|
|
||||||
FP_KEYS_OFF,
|
|
||||||
FP_KEY_DBLTAP_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_HAPTIC_KEY, FP_HAPTIC_NODE);
|
|
||||||
sBooleanNodePreferenceMap.put(FP_HAPTIC_SCREENOFF_KEY, FP_HAPTIC_SCREENOFF_NODE);
|
|
||||||
sBooleanNodePreferenceMap.put(FP_KEYS, FP_KEYS_NODE);
|
|
||||||
sBooleanNodePreferenceMap.put(FP_KEY_DBLTAP, FP_KEY_DBLTAP_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_KEYS_OFF, FP_KEYS_SCREENOFF_NODE);
|
|
||||||
sBooleanNodePreferenceMap.put(FP_KEY_DBLTAP_OFF, FP_KEY_SCREENOFF_DBLTAP_NODE);
|
|
||||||
sBooleanNodePreferenceMap.put(FP_KEY_HOLD_OFF, FP_KEY_SCREENOFF_HOLD_NODE);
|
|
||||||
sBooleanNodePreferenceMap.put(FP_KEY_LEFT_OFF, FP_KEY_SCREENOFF_LEFT_NODE);
|
|
||||||
sBooleanNodePreferenceMap.put(FP_KEY_RIGHT_OFF, FP_KEY_SCREENOFF_RIGHT_NODE);
|
|
||||||
sNodeDefaultMap.put(FP_HOME_KEY, false);
|
|
||||||
sNodeDefaultMap.put(FP_HOME_KEY_OFF, false);
|
|
||||||
sNodeDefaultMap.put(FP_HAPTIC_KEY, false);
|
|
||||||
sNodeDefaultMap.put(FP_HAPTIC_SCREENOFF_KEY, false);
|
|
||||||
sNodeDefaultMap.put(FP_KEYS, "0");
|
|
||||||
sNodeDefaultMap.put(FP_KEY_DBLTAP, "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_DBLTAP_OFF, "0");
|
|
||||||
sNodeDefaultMap.put(FP_KEY_HOLD_OFF, "0");
|
|
||||||
sNodeDefaultMap.put(FP_KEY_LEFT_OFF, "0");
|
|
||||||
sNodeDefaultMap.put(FP_KEY_RIGHT_OFF, "0");
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean isPreferenceEnabled(Context context, String key) {
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
return preferences.getBoolean(key, (Boolean) sNodeDefaultMap.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static String GetPreference(Context context, String key) {
|
|
||||||
SharedPreferences preferences = PreferenceManager.getDefaultSharedPreferences(context);
|
|
||||||
return preferences.getString(key, (String) sNodeDefaultMap.get(key));
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void writePreference(Context context, String pref) {
|
|
||||||
|
|
||||||
String value = "1";
|
|
||||||
|
|
||||||
if (!pref.equals(FP_KEYS) && !pref.equals(FP_KEY_DBLTAP) && !pref.equals(FP_KEY_HOLD) && !pref.equals(FP_KEY_LEFT) && !pref.equals(FP_KEY_RIGHT) &&
|
|
||||||
!pref.equals(FP_KEYS_OFF) && !pref.equals(FP_KEY_DBLTAP_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);
|
|
||||||
|
|
||||||
String node = sBooleanNodePreferenceMap.get(pref);
|
|
||||||
|
|
||||||
if (!FileUtils.writeLine(node, value)) {
|
|
||||||
Log.w(TAG, "Write " + value + " to node " + node +
|
|
||||||
"failed while restoring saved preference values");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,146 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.actions;
|
|
||||||
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.os.VibrationEffect;
|
|
||||||
import android.os.Vibrator;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.MotoActionsSettings;
|
|
||||||
import com.moto.actions.SensorHelper;
|
|
||||||
|
|
||||||
public class FlipToMute implements UpdatedStateNotifier {
|
|
||||||
private static final String TAG = "MotoActions-FlipToMute";
|
|
||||||
|
|
||||||
private final NotificationManager mNotificationManager;
|
|
||||||
private final MotoActionsSettings mMotoActionsSettings;
|
|
||||||
private final SensorHelper mSensorHelper;
|
|
||||||
private final Sensor mFlatDown;
|
|
||||||
private final Sensor mStow;
|
|
||||||
|
|
||||||
private boolean canVibrate = false;
|
|
||||||
private boolean mIsEnabled;
|
|
||||||
private boolean mIsFlatDown;
|
|
||||||
private boolean mIsStowed;
|
|
||||||
private int mFilter;
|
|
||||||
private Context mContext;
|
|
||||||
private Receiver mReceiver;
|
|
||||||
|
|
||||||
public FlipToMute(MotoActionsSettings motoActionsSettings, Context context,
|
|
||||||
SensorHelper sensorHelper) {
|
|
||||||
mMotoActionsSettings = motoActionsSettings;
|
|
||||||
mContext = context;
|
|
||||||
mSensorHelper = sensorHelper;
|
|
||||||
mFlatDown = sensorHelper.getFlatDownSensor();
|
|
||||||
mStow = sensorHelper.getStowSensor();
|
|
||||||
mNotificationManager =
|
|
||||||
(NotificationManager) context.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
if (mNotificationManager != null) {
|
|
||||||
mFilter = mNotificationManager.getCurrentInterruptionFilter();
|
|
||||||
}
|
|
||||||
mReceiver = new Receiver();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateState() {
|
|
||||||
if (mMotoActionsSettings.isFlipToMuteEnabled() && !mIsEnabled) {
|
|
||||||
Log.d(TAG, "Enabling");
|
|
||||||
mSensorHelper.registerListener(mFlatDown, mFlatDownListener);
|
|
||||||
mSensorHelper.registerListener(mStow, mStowListener);
|
|
||||||
mContext.registerReceiver(mReceiver,
|
|
||||||
new IntentFilter(NotificationManager.ACTION_INTERRUPTION_FILTER_CHANGED));
|
|
||||||
mIsEnabled = true;
|
|
||||||
} else if (!mMotoActionsSettings.isFlipToMuteEnabled() && mIsEnabled) {
|
|
||||||
Log.d(TAG, "Disabling");
|
|
||||||
mSensorHelper.unregisterListener(mFlatDownListener);
|
|
||||||
mSensorHelper.unregisterListener(mStowListener);
|
|
||||||
mContext.unregisterReceiver(mReceiver);
|
|
||||||
mIsEnabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private SensorEventListener mFlatDownListener = new SensorEventListener() {
|
|
||||||
@Override
|
|
||||||
public synchronized void onSensorChanged(SensorEvent event) {
|
|
||||||
mIsFlatDown = (event.values[0] != 0);
|
|
||||||
sensorChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor mSensor, int accuracy) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private SensorEventListener mStowListener = new SensorEventListener() {
|
|
||||||
@Override
|
|
||||||
public synchronized void onSensorChanged(SensorEvent event) {
|
|
||||||
mIsStowed = (event.values[0] != 0);
|
|
||||||
sensorChange();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor mSensor, int accuracy) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
|
|
||||||
private void sensorChange() {
|
|
||||||
|
|
||||||
Log.d(TAG, "event: " + mIsFlatDown + " mIsStowed=" + mIsStowed);
|
|
||||||
|
|
||||||
if (mIsFlatDown && mIsStowed) {
|
|
||||||
vibrate();
|
|
||||||
canVibrate = true;
|
|
||||||
mNotificationManager.setInterruptionFilter(NotificationManager.INTERRUPTION_FILTER_PRIORITY);
|
|
||||||
Log.d(TAG, "Interrupt filter: Allow priority");
|
|
||||||
} else if (!mIsFlatDown) {
|
|
||||||
if (canVibrate) {
|
|
||||||
vibrate();
|
|
||||||
canVibrate = false;
|
|
||||||
}
|
|
||||||
mNotificationManager.setInterruptionFilter(mFilter);
|
|
||||||
Log.d(TAG, "Interrupt filter: Restore");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void vibrate() {
|
|
||||||
Vibrator vib = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
|
|
||||||
if (vib == null) return;
|
|
||||||
VibrationEffect effect = VibrationEffect.createOneShot(250, VibrationEffect.DEFAULT_AMPLITUDE);
|
|
||||||
vib.vibrate(effect);
|
|
||||||
}
|
|
||||||
|
|
||||||
public class Receiver extends BroadcastReceiver {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (!mIsFlatDown && !mIsStowed) {
|
|
||||||
if (mNotificationManager == null) return;
|
|
||||||
mFilter = mNotificationManager.getCurrentInterruptionFilter();
|
|
||||||
Log.d(TAG, "Interrupt filter: Backup");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2016 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.actions;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.telephony.PhoneStateListener;
|
|
||||||
import android.telecom.TelecomManager;
|
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.MotoActionsSettings;
|
|
||||||
import com.moto.actions.SensorHelper;
|
|
||||||
|
|
||||||
public class LiftToSilence extends PhoneStateListener implements SensorEventListener, UpdatedStateNotifier {
|
|
||||||
private static final String TAG = "MotoActions-LiftToSilence";
|
|
||||||
|
|
||||||
private final MotoActionsSettings mMotoActionsSettings;
|
|
||||||
private final SensorHelper mSensorHelper;
|
|
||||||
private final Sensor mFlatUpSensor;
|
|
||||||
private final Sensor mStowSensor;
|
|
||||||
|
|
||||||
private final TelecomManager mTelecomManager;
|
|
||||||
private final TelephonyManager mTelephonyManager;
|
|
||||||
|
|
||||||
private boolean mIsRinging;
|
|
||||||
private boolean mIsStowed;
|
|
||||||
private boolean mLastFlatUp;
|
|
||||||
|
|
||||||
public LiftToSilence(MotoActionsSettings motoActionsSettings, Context context,
|
|
||||||
SensorHelper sensorHelper) {
|
|
||||||
mMotoActionsSettings = motoActionsSettings;
|
|
||||||
mSensorHelper = sensorHelper;
|
|
||||||
mFlatUpSensor = sensorHelper.getFlatUpSensor();
|
|
||||||
mStowSensor = sensorHelper.getStowSensor();
|
|
||||||
mTelecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
|
|
||||||
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateState() {
|
|
||||||
if (mMotoActionsSettings.isLiftToSilenceEnabled()) {
|
|
||||||
mTelephonyManager.listen(this, LISTEN_CALL_STATE);
|
|
||||||
} else {
|
|
||||||
mTelephonyManager.listen(this, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void onCallStateChanged(int state, String incomingNumber) {
|
|
||||||
if (state == TelephonyManager.CALL_STATE_RINGING && !mIsRinging) {
|
|
||||||
Log.d(TAG, "Ringing started");
|
|
||||||
mSensorHelper.registerListener(mFlatUpSensor, this);
|
|
||||||
mSensorHelper.registerListener(mStowSensor, mStowListener);
|
|
||||||
mIsRinging = true;
|
|
||||||
} else if (state != TelephonyManager.CALL_STATE_RINGING && mIsRinging) {
|
|
||||||
Log.d(TAG, "Ringing stopped");
|
|
||||||
mSensorHelper.unregisterListener(this);
|
|
||||||
mSensorHelper.unregisterListener(mStowListener);
|
|
||||||
mIsRinging = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void onSensorChanged(SensorEvent event) {
|
|
||||||
boolean thisFlatUp = (event.values[0] != 0);
|
|
||||||
|
|
||||||
Log.d(TAG, "event: " + thisFlatUp + " mLastFlatUp=" + mLastFlatUp + " mIsStowed=" +
|
|
||||||
mIsStowed);
|
|
||||||
|
|
||||||
if (mLastFlatUp && !thisFlatUp && !mIsStowed) {
|
|
||||||
mTelecomManager.silenceRinger();
|
|
||||||
}
|
|
||||||
mLastFlatUp = thisFlatUp;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor mSensor, int accuracy) {
|
|
||||||
}
|
|
||||||
|
|
||||||
private SensorEventListener mStowListener = new SensorEventListener() {
|
|
||||||
@Override
|
|
||||||
public synchronized void onSensorChanged(SensorEvent event) {
|
|
||||||
mIsStowed = (event.values[0] != 0);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor mSensor, int accuracy) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,109 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.actions;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.telephony.PhoneStateListener;
|
|
||||||
import android.telecom.TelecomManager;
|
|
||||||
import android.telephony.TelephonyManager;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.MotoActionsSettings;
|
|
||||||
import com.moto.actions.SensorHelper;
|
|
||||||
|
|
||||||
import static android.telephony.TelephonyManager.*;
|
|
||||||
|
|
||||||
public class ProximitySilencer extends PhoneStateListener implements SensorEventListener, UpdatedStateNotifier {
|
|
||||||
private static final String TAG = "MotoActions-ProximitySilencer";
|
|
||||||
|
|
||||||
private static final int SILENCE_DELAY_MS = 500;
|
|
||||||
|
|
||||||
private final TelecomManager mTelecomManager;
|
|
||||||
private final TelephonyManager mTelephonyManager;
|
|
||||||
private final MotoActionsSettings mMotoActionsSettings;
|
|
||||||
private final SensorHelper mSensorHelper;
|
|
||||||
private final Sensor mSensor;
|
|
||||||
private boolean mIsRinging;
|
|
||||||
private long mRingStartedMs;
|
|
||||||
private boolean mCoveredRinging;
|
|
||||||
|
|
||||||
public ProximitySilencer(MotoActionsSettings motoActionsSettings, Context context,
|
|
||||||
SensorHelper sensorHelper) {
|
|
||||||
mTelecomManager = (TelecomManager) context.getSystemService(Context.TELECOM_SERVICE);
|
|
||||||
mTelephonyManager = (TelephonyManager) context.getSystemService(Context.TELEPHONY_SERVICE);
|
|
||||||
|
|
||||||
mMotoActionsSettings = motoActionsSettings;
|
|
||||||
mSensorHelper = sensorHelper;
|
|
||||||
mSensor = sensorHelper.getProximitySensor();
|
|
||||||
mCoveredRinging = false;
|
|
||||||
mIsRinging = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void updateState() {
|
|
||||||
if (mMotoActionsSettings.isIrSilencerEnabled()) {
|
|
||||||
mTelephonyManager.listen(this, LISTEN_CALL_STATE);
|
|
||||||
} else {
|
|
||||||
mTelephonyManager.listen(this, 0);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void onSensorChanged(SensorEvent event) {
|
|
||||||
boolean isNear = event.values[0] < mSensor.getMaximumRange();
|
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
|
|
||||||
if (isNear){
|
|
||||||
mCoveredRinging = mIsRinging && (now - mRingStartedMs >= SILENCE_DELAY_MS);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (mIsRinging) {
|
|
||||||
Log.d(TAG, "event: " + event.values[0] + ", " + " covered " + Boolean.toString(mCoveredRinging));
|
|
||||||
if (mCoveredRinging) {
|
|
||||||
Log.d(TAG, "Silencing ringer");
|
|
||||||
mTelecomManager.silenceRinger();
|
|
||||||
} else {
|
|
||||||
Log.d(TAG, "Ignoring silence gesture: " + now + " is too close to " +
|
|
||||||
mRingStartedMs + ", delay=" + SILENCE_DELAY_MS);
|
|
||||||
}
|
|
||||||
mCoveredRinging = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public synchronized void onCallStateChanged(int state, String incomingNumber) {
|
|
||||||
if (state == CALL_STATE_RINGING && !mIsRinging) {
|
|
||||||
Log.d(TAG, "Ringing started");
|
|
||||||
mSensorHelper.registerListener(mSensor, this);
|
|
||||||
mIsRinging = true;
|
|
||||||
mRingStartedMs = System.currentTimeMillis();
|
|
||||||
} else if (state != CALL_STATE_RINGING && mIsRinging) {
|
|
||||||
Log.d(TAG, "Ringing stopped");
|
|
||||||
mSensorHelper.unregisterListener(this);
|
|
||||||
mIsRinging = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor mSensor, int accuracy) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,87 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.actions;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.hardware.camera2.CameraAccessException;
|
|
||||||
import android.hardware.camera2.CameraCharacteristics;
|
|
||||||
import android.hardware.camera2.CameraManager;
|
|
||||||
import android.os.VibrationEffect;
|
|
||||||
import android.os.Vibrator;
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
|
|
||||||
import com.moto.actions.SensorAction;
|
|
||||||
|
|
||||||
public class TorchAction implements SensorAction {
|
|
||||||
private static final String TAG = "MotoActions";
|
|
||||||
|
|
||||||
private CameraManager mCameraManager;
|
|
||||||
private final Vibrator mVibrator;
|
|
||||||
private String mRearCameraId;
|
|
||||||
private static boolean mTorchEnabled;
|
|
||||||
|
|
||||||
public TorchAction(Context mContext) {
|
|
||||||
mCameraManager = (CameraManager) mContext.getSystemService(Context.CAMERA_SERVICE);
|
|
||||||
mCameraManager.registerTorchCallback(new MyTorchCallback(), null);
|
|
||||||
mVibrator = (Vibrator) mContext.getSystemService(Context.VIBRATOR_SERVICE);
|
|
||||||
try {
|
|
||||||
for (final String cameraId : mCameraManager.getCameraIdList()) {
|
|
||||||
CameraCharacteristics characteristics =
|
|
||||||
mCameraManager.getCameraCharacteristics(cameraId);
|
|
||||||
int cOrientation = characteristics.get(CameraCharacteristics.LENS_FACING);
|
|
||||||
if (cOrientation == CameraCharacteristics.LENS_FACING_BACK) {
|
|
||||||
mRearCameraId = cameraId;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} catch (CameraAccessException e) {
|
|
||||||
// Noop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void action() {
|
|
||||||
VibrationEffect vibrationEffect = VibrationEffect.createOneShot(250, VibrationEffect.DEFAULT_AMPLITUDE);
|
|
||||||
mVibrator.vibrate(vibrationEffect);
|
|
||||||
if (mRearCameraId != null) {
|
|
||||||
try {
|
|
||||||
mCameraManager.setTorchMode(mRearCameraId, !mTorchEnabled);
|
|
||||||
mTorchEnabled = !mTorchEnabled;
|
|
||||||
} catch (CameraAccessException e) {
|
|
||||||
// Noop
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class MyTorchCallback extends CameraManager.TorchCallback {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTorchModeChanged(@NonNull String cameraId, boolean enabled) {
|
|
||||||
if (!cameraId.equals(mRearCameraId))
|
|
||||||
return;
|
|
||||||
mTorchEnabled = enabled;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onTorchModeUnavailable(@NonNull String cameraId) {
|
|
||||||
if (!cameraId.equals(mRearCameraId))
|
|
||||||
return;
|
|
||||||
mTorchEnabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.actions;
|
|
||||||
|
|
||||||
public interface UpdatedStateNotifier {
|
|
||||||
void updateState();
|
|
||||||
}
|
|
||||||
@@ -1,66 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.doze;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.SensorAction;
|
|
||||||
|
|
||||||
public class DozePulseAction implements SensorAction, ScreenStateNotifier {
|
|
||||||
private static final String TAG = "MotoActions";
|
|
||||||
|
|
||||||
private static final int DELAY_BETWEEN_DOZES_IN_MS = 1500;
|
|
||||||
|
|
||||||
private final Context mContext;
|
|
||||||
|
|
||||||
private long mLastDoze;
|
|
||||||
|
|
||||||
public DozePulseAction(Context context) {
|
|
||||||
mContext = context;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void screenTurnedOn() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void screenTurnedOff() {
|
|
||||||
mLastDoze = System.currentTimeMillis();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void action() {
|
|
||||||
if (mayDoze()) {
|
|
||||||
Log.d(TAG, "Sending doze.pulse intent");
|
|
||||||
mContext.sendBroadcast(new Intent("com.android.systemui.doze.pulse"));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private synchronized boolean mayDoze() {
|
|
||||||
long now = System.currentTimeMillis();
|
|
||||||
if (now - mLastDoze > DELAY_BETWEEN_DOZES_IN_MS) {
|
|
||||||
Log.d(TAG, "Allowing doze");
|
|
||||||
mLastDoze = now;
|
|
||||||
return true;
|
|
||||||
} else {
|
|
||||||
Log.d(TAG, "Denying doze");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,76 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.doze;
|
|
||||||
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.MotoActionsSettings;
|
|
||||||
import com.moto.actions.SensorAction;
|
|
||||||
import com.moto.actions.SensorHelper;
|
|
||||||
|
|
||||||
public class GlanceSensor implements ScreenStateNotifier {
|
|
||||||
private static final String TAG = "MotoActions-GlanceSensor";
|
|
||||||
|
|
||||||
private final MotoActionsSettings mMotoActionsSettings;
|
|
||||||
private final SensorHelper mSensorHelper;
|
|
||||||
private final SensorAction mSensorAction;
|
|
||||||
private final Sensor mSensor;
|
|
||||||
|
|
||||||
private boolean mEnabled;
|
|
||||||
|
|
||||||
public GlanceSensor(MotoActionsSettings motoActionsSettings, SensorHelper sensorHelper,
|
|
||||||
SensorAction action) {
|
|
||||||
mMotoActionsSettings = motoActionsSettings;
|
|
||||||
mSensorHelper = sensorHelper;
|
|
||||||
mSensorAction = action;
|
|
||||||
|
|
||||||
mSensor = sensorHelper.getGlanceSensor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void screenTurnedOn() {
|
|
||||||
if (mEnabled) {
|
|
||||||
Log.d(TAG, "Disabling");
|
|
||||||
mSensorHelper.unregisterListener(mGlanceListener);
|
|
||||||
mEnabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void screenTurnedOff() {
|
|
||||||
if (mMotoActionsSettings.isPickUpEnabled() && !mEnabled) {
|
|
||||||
Log.d(TAG, "Enabling");
|
|
||||||
mSensorHelper.registerListener(mSensor, mGlanceListener);
|
|
||||||
mEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private SensorEventListener mGlanceListener = new SensorEventListener() {
|
|
||||||
@Override
|
|
||||||
public void onSensorChanged(SensorEvent event) {
|
|
||||||
Log.d(TAG, "triggered");
|
|
||||||
mSensorAction.action();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor mSensor, int accuracy) {
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@@ -1,81 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.doze;
|
|
||||||
|
|
||||||
import android.hardware.Sensor;
|
|
||||||
import android.hardware.SensorEvent;
|
|
||||||
import android.hardware.SensorEventListener;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import com.moto.actions.MotoActionsSettings;
|
|
||||||
import com.moto.actions.SensorAction;
|
|
||||||
import com.moto.actions.SensorHelper;
|
|
||||||
|
|
||||||
public class ProximitySensor implements ScreenStateNotifier, SensorEventListener {
|
|
||||||
private static final String TAG = "MotoActions-ProximitySensor";
|
|
||||||
|
|
||||||
private final MotoActionsSettings mMotoActionsSettings;
|
|
||||||
private final SensorHelper mSensorHelper;
|
|
||||||
private final SensorAction mSensorAction;
|
|
||||||
private final Sensor mSensor;
|
|
||||||
|
|
||||||
private boolean mEnabled;
|
|
||||||
|
|
||||||
private boolean mSawNear = false;
|
|
||||||
|
|
||||||
public ProximitySensor(MotoActionsSettings motoActionsSettings, SensorHelper sensorHelper,
|
|
||||||
SensorAction action) {
|
|
||||||
mMotoActionsSettings = motoActionsSettings;
|
|
||||||
mSensorHelper = sensorHelper;
|
|
||||||
mSensorAction = action;
|
|
||||||
|
|
||||||
mSensor = sensorHelper.getProximitySensor();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void screenTurnedOn() {
|
|
||||||
if (mEnabled) {
|
|
||||||
Log.d(TAG, "Disabling");
|
|
||||||
mSensorHelper.unregisterListener(this);
|
|
||||||
mEnabled = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void screenTurnedOff() {
|
|
||||||
if (mMotoActionsSettings.isIrWakeupEnabled() && !mEnabled) {
|
|
||||||
Log.d(TAG, "Enabling");
|
|
||||||
mSensorHelper.registerListener(mSensor, this);
|
|
||||||
mEnabled = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onSensorChanged(SensorEvent event) {
|
|
||||||
boolean isNear = event.values[0] < mSensor.getMaximumRange();
|
|
||||||
if (mSawNear && !isNear) {
|
|
||||||
Log.d(TAG, "wave triggered");
|
|
||||||
mSensorAction.action();
|
|
||||||
}
|
|
||||||
mSawNear = isNear;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onAccuracyChanged(Sensor mSensor, int accuracy) {
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,50 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.doze;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import android.content.BroadcastReceiver;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.content.IntentFilter;
|
|
||||||
|
|
||||||
import com.moto.actions.actions.Constants;
|
|
||||||
|
|
||||||
public class ScreenReceiver extends BroadcastReceiver {
|
|
||||||
private final ScreenStateNotifier mNotifier;
|
|
||||||
|
|
||||||
public ScreenReceiver(Context context, ScreenStateNotifier notifier) {
|
|
||||||
mNotifier = notifier;
|
|
||||||
|
|
||||||
IntentFilter filter = new IntentFilter(Intent.ACTION_SCREEN_ON);
|
|
||||||
filter.addAction(Intent.ACTION_SCREEN_OFF);
|
|
||||||
context.registerReceiver(this, filter);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onReceive(Context context, Intent intent) {
|
|
||||||
if (intent.getAction() == null) return;
|
|
||||||
|
|
||||||
if (intent.getAction().equals(Intent.ACTION_SCREEN_OFF)) {
|
|
||||||
mNotifier.screenTurnedOff();
|
|
||||||
} else if (intent.getAction().equals(Intent.ACTION_SCREEN_ON)) {
|
|
||||||
mNotifier.screenTurnedOn();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (c) 2015 The CyanogenMod Project
|
|
||||||
* Copyright (c) 2017 The LineageOS 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.moto.actions.doze;
|
|
||||||
|
|
||||||
public interface ScreenStateNotifier {
|
|
||||||
void screenTurnedOn();
|
|
||||||
void screenTurnedOff();
|
|
||||||
}
|
|
||||||
@@ -1,125 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2016 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.moto.actions.util;
|
|
||||||
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import java.io.BufferedReader;
|
|
||||||
import java.io.BufferedWriter;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.FileNotFoundException;
|
|
||||||
import java.io.FileReader;
|
|
||||||
import java.io.FileWriter;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
public final class FileUtils {
|
|
||||||
private static final String TAG = "FileUtils";
|
|
||||||
|
|
||||||
private FileUtils() {
|
|
||||||
// This class is not supposed to be instantiated
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Reads the first line of text from the given file.
|
|
||||||
* Reference {@link BufferedReader#readLine()} for clarification on what a line is
|
|
||||||
*
|
|
||||||
* @return the read line contents, or null on failure
|
|
||||||
*/
|
|
||||||
public static String readOneLine(String fileName) {
|
|
||||||
String line = "0";
|
|
||||||
BufferedReader reader = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
reader = new BufferedReader(new FileReader(fileName), 512);
|
|
||||||
line = reader.readLine();
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
Log.w(TAG, "No such file " + fileName + " for reading", e);
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Could not read from file " + fileName, e);
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (reader != null) {
|
|
||||||
reader.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
// Ignored, not much we can do anyway
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return line;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Writes the given value into the given file
|
|
||||||
*
|
|
||||||
* @return true on success, false on failure
|
|
||||||
*/
|
|
||||||
public static boolean writeLine(String fileName, String value) {
|
|
||||||
BufferedWriter writer = null;
|
|
||||||
|
|
||||||
try {
|
|
||||||
writer = new BufferedWriter(new FileWriter(fileName));
|
|
||||||
writer.write(value);
|
|
||||||
} catch (FileNotFoundException e) {
|
|
||||||
Log.w(TAG, "No such file " + fileName + " for writing", e);
|
|
||||||
return false;
|
|
||||||
} catch (IOException e) {
|
|
||||||
Log.e(TAG, "Could not write to file " + fileName, e);
|
|
||||||
return false;
|
|
||||||
} finally {
|
|
||||||
try {
|
|
||||||
if (writer != null) {
|
|
||||||
writer.close();
|
|
||||||
}
|
|
||||||
} catch (IOException e) {
|
|
||||||
// Ignored, not much we can do anyway
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the given file exists
|
|
||||||
*
|
|
||||||
* @return true if exists, false if not
|
|
||||||
*/
|
|
||||||
public static boolean fileExists(String fileName) {
|
|
||||||
final File file = new File(fileName);
|
|
||||||
return file.exists();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the given file is readable
|
|
||||||
*
|
|
||||||
* @return true if readable, false if not
|
|
||||||
*/
|
|
||||||
public static boolean isFileReadable(String fileName) {
|
|
||||||
final File file = new File(fileName);
|
|
||||||
return file.exists() && file.canRead();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Checks whether the given file is writable
|
|
||||||
*
|
|
||||||
* @return true if writable, false if not
|
|
||||||
*/
|
|
||||||
public static boolean isFileWritable(String fileName) {
|
|
||||||
final File file = new File(fileName);
|
|
||||||
return file.exists() && file.canWrite();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -9,5 +9,11 @@
|
|||||||
"repository": "kernel_motorola_msm8953",
|
"repository": "kernel_motorola_msm8953",
|
||||||
"target_path": "kernel/motorola/msm8953",
|
"target_path": "kernel/motorola/msm8953",
|
||||||
"branch": "eleven"
|
"branch": "eleven"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"repository" : "hardware_motorola",
|
||||||
|
"target_path" : "hardware/motorola",
|
||||||
|
"branch" : "eleven",
|
||||||
|
"remote" : "pixel"
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
|
|||||||
Reference in New Issue
Block a user