From 7ef323f18df20da3714cc8fc5b702e3c78846ad2 Mon Sep 17 00:00:00 2001 From: henrichg Date: Tue, 13 Feb 2024 14:45:16 +0100 Subject: [PATCH 01/19] ... --- cospravit.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cospravit.txt b/cospravit.txt index 8f59af622e..af341d4cad 100644 --- a/cospravit.txt +++ b/cospravit.txt @@ -494,7 +494,7 @@ https://developer.android.com/develop/connectivity/nfc/nfc#ext-type - Fix: Fixed simulation of ringing. - Fix: Fixed leak in quick tiles. - Fixed bugs. -- Updated transaltions. +- Updated translations. From c0ba0ae6299ac5530026aaa265fa96c889da170e Mon Sep 17 00:00:00 2001 From: henrichg Date: Wed, 14 Feb 2024 19:33:03 +0100 Subject: [PATCH 02/19] Fix: java.lang.NullPointerException: Attempt to invoke virtual method 'boolean android.net.Uri.equals(java.lang.Object)' on a null object reference at sk.henrichg.phoneprofilesplus.ActivateProfileHelper.setTones(ActivateProfileHelper.java:2133) --- .../ActivateProfileHelper.java | 74 +++++++++---------- 1 file changed, 35 insertions(+), 39 deletions(-) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java index f563886b62..7ef3decfa5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java @@ -2130,7 +2130,8 @@ private static boolean setTones(Context context, Profile profile, //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); //PPApplicationStatic.recordException(e); } - if (!RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE).equals(uri)) + Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); + if ((actualUri == null) || (!actualUri.equals(uri))) RingtoneManager.setActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE, uri); } } @@ -2146,6 +2147,7 @@ private static boolean setTones(Context context, Profile profile, PPApplicationStatic.addActivityLog(appContext, PPApplication.ALTYPE_PROFILE_ERROR_SET_TONE_RINGTONE, null, profile._name, ""); noError = false; + //PPApplicationStatic.recordException(e); /*String[] splits = profile._soundRingtone.split(StringConstants.STR_SPLIT_REGEX); if (!splits[0].isEmpty()) { try { @@ -2208,7 +2210,8 @@ private static boolean setTones(Context context, Profile profile, //PPApplicationStatic.recordException(e); } - if (!RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_NOTIFICATION).equals(uri)) + Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_NOTIFICATION); + if ((actualUri == null) || (!actualUri.equals(uri))) RingtoneManager.setActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_NOTIFICATION, uri); } } @@ -2283,7 +2286,8 @@ private static boolean setTones(Context context, Profile profile, //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); //PPApplicationStatic.recordException(e); } - if (!RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_ALARM).equals(uri)) + Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_ALARM); + if ((actualUri == null) || (!actualUri.equals(uri))) RingtoneManager.setActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_ALARM, uri); } } @@ -2388,8 +2392,8 @@ private static boolean setTones(Context context, Profile profile, uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); } catch (Exception ignored) { } - if (!Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM1_SAMSUNG).equals(uri.toString())) + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_SAMSUNG); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_SAMSUNG, uri.toString()); } else if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI) && (uri != null)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Huawei uri=" + uri.toString()); @@ -2398,8 +2402,8 @@ private static boolean setTones(Context context, Profile profile, uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); } catch (Exception ignored) { } - if (!Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM1_HUAWEI).equals(uri.toString())) + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_HUAWEI); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_HUAWEI, uri.toString()); } else if (PPApplication.deviceIsXiaomi && (PPApplication.romIsMIUI) && (uri != null)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Xiaomi uri=" + uri.toString()); @@ -2408,8 +2412,8 @@ private static boolean setTones(Context context, Profile profile, uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); } catch (Exception ignored) { } - if (!Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM1_XIAOMI).equals(uri.toString())) + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_XIAOMI); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_XIAOMI, uri.toString()); } else if (PPApplication.deviceIsOnePlus && (uri != null)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 OnePlus uri=" + uri.toString()); @@ -2418,8 +2422,8 @@ private static boolean setTones(Context context, Profile profile, uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); } catch (Exception ignored) { } - if (!Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM1_ONEPLUS).equals(uri.toString())) + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_ONEPLUS); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_ONEPLUS, uri.toString()); } } @@ -2467,32 +2471,28 @@ private static boolean setTones(Context context, Profile profile, if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Samsung uri=null"); - if (Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM1_SAMSUNG) != null) + if ((Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_SAMSUNG) != null)) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_SAMSUNG, null); } else if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Huawei uri=null"); - if (Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM1_HUAWEI) != null) + if ((Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_HUAWEI) != null)) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_HUAWEI, null); } else if (PPApplication.deviceIsXiaomi && (PPApplication.romIsMIUI)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Xiaomi uri=null"); - if (Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM1_XIAOMI) != null) + if ((Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_XIAOMI) != null)) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_XIAOMI, null); } else if (PPApplication.deviceIsOnePlus) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 OnePlus uri=null"); - if (Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM1_ONEPLUS) != null) + if ((Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_ONEPLUS) != null)) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_ONEPLUS, null); } } @@ -2553,8 +2553,8 @@ private static boolean setTones(Context context, Profile profile, uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); } catch (Exception ignored) { } - if (!Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM2_SAMSUNG).equals(uri.toString())) + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_SAMSUNG); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_SAMSUNG, uri.toString()); } else if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI) && (uri != null)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Huawei uri=" + uri.toString()); @@ -2563,8 +2563,8 @@ private static boolean setTones(Context context, Profile profile, uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); } catch (Exception ignored) { } - if (!Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM2_HUAWEI).equals(uri.toString())) + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_HUAWEI); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_HUAWEI, uri.toString()); } else if (PPApplication.deviceIsXiaomi && (PPApplication.romIsMIUI) && (uri != null)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Xiaomi uri=" + uri.toString()); @@ -2573,8 +2573,8 @@ private static boolean setTones(Context context, Profile profile, uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); } catch (Exception ignored) { } - if (!Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM2_XIAOMI).equals(uri.toString())) + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_XIAOMI); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_XIAOMI, uri.toString()); } else if (PPApplication.deviceIsOnePlus && (uri != null)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 OnePlus uri=" + uri.toString()); @@ -2583,8 +2583,8 @@ private static boolean setTones(Context context, Profile profile, uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); } catch (Exception ignored) { } - if (!Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM2_ONEPLUS).equals(uri.toString())) + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_ONEPLUS); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_ONEPLUS, uri.toString()); } } @@ -2630,26 +2630,22 @@ private static boolean setTones(Context context, Profile profile, if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Samsung uri=null"); - if (Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM2_SAMSUNG) != null) + if (Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_SAMSUNG) != null) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_SAMSUNG, null); } else if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Huawei uri=null"); - if (Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM2_HUAWEI) != null) + if (Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_HUAWEI) != null) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_HUAWEI, null); } else if (PPApplication.deviceIsXiaomi && (PPApplication.romIsMIUI)) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Xiaomi uri=null"); - if (Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM2_XIAOMI) != null) + if (Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_XIAOMI) != null) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_XIAOMI, null); } else if (PPApplication.deviceIsOnePlus) { // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 OnePlus uri=null"); - if (Settings.System.getString(appContext.getContentResolver(), - PREF_RINGTONE_SIM2_ONEPLUS) != null) + if (Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_ONEPLUS) != null) Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_ONEPLUS, null); } } catch (IllegalArgumentException | IllegalStateException e) { @@ -6729,8 +6725,8 @@ private static void setGPS(Context context, boolean enable) String newSet; newSet = GPS_ON; //noinspection deprecation - if (!Settings.Secure.getString(appContext.getContentResolver(), - Settings.Secure.LOCATION_PROVIDERS_ALLOWED).equals(newSet)) + String actualValue = Settings.Secure.getString(appContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); + if ((actualValue == null) || (!actualValue.equals(newSet))) //noinspection deprecation Settings.Secure.putString(appContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, newSet); } @@ -6789,8 +6785,8 @@ private static void setGPS(Context context, boolean enable) String newSet;// = ""; newSet = GPS_OFF; //noinspection deprecation - if (!Settings.Secure.getString(appContext.getContentResolver(), - Settings.Secure.LOCATION_PROVIDERS_ALLOWED).equals(newSet)) + String actualValue = Settings.Secure.getString(appContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED); + if ((actualValue == null) || (!actualValue.equals(newSet))) //noinspection deprecation Settings.Secure.putString(appContext.getContentResolver(), Settings.Secure.LOCATION_PROVIDERS_ALLOWED, newSet); } From 71862815aa72283a2ede0a0a39b6677fa6ddbd01 Mon Sep 17 00:00:00 2001 From: henrichg Date: Thu, 15 Feb 2024 10:14:46 +0100 Subject: [PATCH 03/19] Updated translations. --- common/src/main/res/values-uk/strings.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/common/src/main/res/values-uk/strings.xml b/common/src/main/res/values-uk/strings.xml index 34637c3e93..9a3fede254 100644 --- a/common/src/main/res/values-uk/strings.xml +++ b/common/src/main/res/values-uk/strings.xml @@ -649,7 +649,7 @@ Перезавантаження подій Натисніть кнопку для перезавантаження подій. Ви мусите перезавантажити події, якщо профіль був активований вручну. Журнал дій - Натисніть тут щоб відкрити журнал дій. Занотовуються дані про старт/пауза/стоп події, активації профілів, запуску застосунків і т. п. + Натисніть тут, щоб відкрити журнал дій. Занотовуються дані про старт/пауза/стоп події, активації профілів, запуску застосунків і т. п. Новий профіль Натисніть тут, щоб додати новий профіль. Вилучити усі профілі @@ -833,7 +833,7 @@ Увімкнути сканування місцеположення Увімкнути сканування стільникових веж Увімкнути сканування орієнтації - (G1)(R) Сповіщення що спливають + (G1)(R) Сповіщення що виринають Власна іконка Натисніть, щоб встановити назву вежі Підключення до точки доступу з інших пристроїв може не працювати. @@ -915,7 +915,7 @@ Не запитувати знову Використовувати будильник Термін дії профілю й події, датчик часу, датчик календаря, затримка старту та закінчення події не є вірними коли екран вимкнуто. Аби все було файно треба увімкнути цей параметр. В рядку стану з\'явиться іконка будильнику. - Термін дії профілю й події, датчик часу, датчик календаря, затримка старту та закінчення події не є вірними коли екран вимкнуто. Увімкніть в налаштуваннях додатку \"Система\"→\"Використовувати будильник\" щоб все було точним. В рядку стану з\'явиться іконка будильнику. + Термін дії профілю й події, датчик часу, датчик календаря, затримка старту та закінчення подій не чітко працюють коли екран вимкнуто. Увімкніть в налаштуваннях застосунку \"Система\"→\"Використовувати будильник\", щоб все працювало відповідно. В рядку стану з\'явиться іконка будильнику. Змінити ім\'я Деякі підкреслені параметри не налаштовано! Показувати вікно що спливає @@ -1244,7 +1244,7 @@ Параметри, відмічені [M] використовуються тільки тоді, коли профіль активовано вручну. Активація з події ігнорує ці параметри. запитати Віджет не спрацьовує при натисканні - Якщо віджет PhoneProfilesPlus не працює (при натисканні), увімкніть дозвіл у налаштуваннях пристрою: Налаштування / Додатки / Керування програмами / PhoneProfilesPlus / Інші дозволи / Відображати спливаючі вікна під час роботи у фоні. + Якщо віджет PhoneProfilesPlus не працює (при натисканні), увімкніть дозвіл у налаштуваннях пристрою: Налаштування / Застосунки / Керування програмами / PhoneProfilesPlus / Інші дозволи / Показувати вікна що виринають під час роботи у фоні. 13% 38% 63% @@ -1604,7 +1604,7 @@ Примусово вбудовані (для користувацьких іконок) Запустити застосунки, ярлики, intents для \"MIUI\" Для \"MIUI\" потрібно дати деякі дозволи. Натисніть тут, щоб побачити як. - У Налаштуваннях/Додатки/Керування застосунками/PhoneProfilesPlus/Інші дозволи: \"Показувати вікна що виринають під час роботи у фоні\" і \"Показати на екрані блокування\" виберіть \"Дозволити\". + У Налаштуваннях/Застосунки/Керування застосунками/PhoneProfilesPlus/Інші дозволи: \"Показувати вікна що виринають під час роботи у фоні\" і \"Показати на екрані блокування\" виберіть \"Дозволити\". Показати дозволи Вібрувати під час виклику/Вібрація під час сповіщення Вібрація під час сповіщення @@ -2139,7 +2139,7 @@ Зчитати тег NFC записаний у PhonePorfilesPlus. Ярлик \"Зчитати NFC мітку\" Натисніть тут, щоб створити ярлик для \"Зчитати NFC мітку\" в лаунчері. - If your device shows a notification when reading NFC tag that there is no application in the foreground to support reading NFC tags (for example, some Xiaomi devices), create this shortcut and use it every time you want to read NFC tag to trigger event in PPP. + Якщо Ваш пристрій, під час читання мітки NFC, показує повідомлення, що немає застосунку для читання мітки NFC( наприклад, деякі пристрої Xiaomi), створить цей ярлик і використовуйте його кожен раз коли читаєте мітку NFC, щоб запустити подію в PPP. Ярлик \"Зчитати NFC мітку\" створено Прикладіть ваш телефон до NFC мітки. Зчитування розпочнеться. Назва мітки: From 3c09cd81b99eb21043e7eb33daf0fa86032979b3 Mon Sep 17 00:00:00 2001 From: henrichg Date: Thu, 15 Feb 2024 13:06:38 +0100 Subject: [PATCH 04/19] Change: Added dependenciesInfo into gradle. Requested by IzzyOnDroid. --- phoneProfilesPlus/build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/phoneProfilesPlus/build.gradle b/phoneProfilesPlus/build.gradle index 5610315a14..01e4ebd234 100644 --- a/phoneProfilesPlus/build.gradle +++ b/phoneProfilesPlus/build.gradle @@ -54,6 +54,12 @@ android { enableSplit = false } } + dependenciesInfo { + // Disables dependency metadata when building APKs. + includeInApk = false + // Disables dependency metadata when building Android App Bundles. + includeInBundle = false + } } dependencies { From 49fa1f28a60fcd5d464ecc994489ae80e65d0c85 Mon Sep 17 00:00:00 2001 From: henrichg Date: Thu, 15 Feb 2024 13:09:29 +0100 Subject: [PATCH 05/19] ... --- phoneProfilesPlus/build.gradle | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phoneProfilesPlus/build.gradle b/phoneProfilesPlus/build.gradle index 01e4ebd234..15a18db68a 100644 --- a/phoneProfilesPlus/build.gradle +++ b/phoneProfilesPlus/build.gradle @@ -54,6 +54,8 @@ android { enableSplit = false } } + + // Requested by IzzyOnDroid. dependenciesInfo { // Disables dependency metadata when building APKs. includeInApk = false From 7558ee1fd92cc5878efafcf1bb176d1b45e238b7 Mon Sep 17 00:00:00 2001 From: henrichg Date: Thu, 15 Feb 2024 19:48:44 +0100 Subject: [PATCH 06/19] Added list of permissions. --- README.md | 3 +++ docs/permissions.md | 47 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+) create mode 100644 docs/permissions.md diff --git a/README.md b/README.md index 228243c055..78c05c713b 100644 --- a/README.md +++ b/README.md @@ -83,6 +83,9 @@ _*** Please help me with translation, thank you: Date: Fri, 16 Feb 2024 08:35:11 +0100 Subject: [PATCH 07/19] Fix: Fixed bad working brightness mode change to automatic. --- .../phoneprofilesplus/ActivateProfileHelper.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java index 7ef3decfa5..d8f221e648 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java @@ -4971,13 +4971,13 @@ static void execute(final Context context, final Profile profile) try { //noinspection IfStatementWithIdenticalBranches if (profile.getDeviceBrightnessAutomatic()) { + if (Settings.System.getInt(appContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS_MODE, -1) != + Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) + Settings.System.putInt(appContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS_MODE, + Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); if (profile.getDeviceBrightnessChangeLevel()) { - if (Settings.System.getInt(appContext.getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS_MODE, -1) != - Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) - Settings.System.putInt(appContext.getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS_MODE, - Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); int newBrightness = profile.getDeviceBrightnessManualValue(appContext); if (Settings.System.getInt(appContext.getContentResolver(), Settings.System.SCREEN_BRIGHTNESS, -1) != newBrightness) From 54d16aec65e2eb1752d173e63dd1c26fe026c162 Mon Sep 17 00:00:00 2001 From: henrichg Date: Fri, 16 Feb 2024 10:23:33 +0100 Subject: [PATCH 08/19] Fix: Fixed set tone when external tone not found. --- ...neProfilesPlus.AndroidClearChroma.main.iml | 2 + .../PhoneProfilesPlus.RootShell.main.iml | 2 + .../PhoneProfilesPlus.RootTools.main.iml | 2 + .../PhoneProfilesPlus.ToastCompat.main.iml | 2 + ...rofilesPlus.android-betterpickers.main.iml | 2 + .../common/PhoneProfilesPlus.common.main.iml | 2 + ...PhoneProfilesPlus.noobcameraflash.main.iml | 2 + ...oneProfilesPlus.phoneProfilesPlus.main.iml | 2 + ...filesPlus.recyclerview-fastscroll.main.iml | 2 + ...ProfilesPlus.time-duration-picker.main.iml | 2 + .../ActivateProfileHelper.java | 651 +++++++++--------- 11 files changed, 355 insertions(+), 316 deletions(-) diff --git a/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.main.iml b/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.main.iml index 478460cd8b..3d6f84241d 100644 --- a/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.main.iml +++ b/.idea/modules/AndroidClearChroma/PhoneProfilesPlus.AndroidClearChroma.main.iml @@ -19,12 +19,14 @@ + + diff --git a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.main.iml b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.main.iml index c336ad089c..9a8a1c6274 100644 --- a/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.main.iml +++ b/.idea/modules/RootShell/PhoneProfilesPlus.RootShell.main.iml @@ -19,6 +19,7 @@ + @@ -32,6 +33,7 @@ + diff --git a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.main.iml b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.main.iml index 2916c47645..c9c1270686 100644 --- a/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.main.iml +++ b/.idea/modules/RootTools/PhoneProfilesPlus.RootTools.main.iml @@ -19,12 +19,14 @@ + + diff --git a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.main.iml b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.main.iml index 8faeebf26d..3665cb41ed 100644 --- a/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.main.iml +++ b/.idea/modules/ToastCompat/PhoneProfilesPlus.ToastCompat.main.iml @@ -19,12 +19,14 @@ + + diff --git a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.main.iml b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.main.iml index fd10f651cd..66d1b0c29c 100644 --- a/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.main.iml +++ b/.idea/modules/android-betterpickers/PhoneProfilesPlus.android-betterpickers.main.iml @@ -19,6 +19,7 @@ + @@ -32,6 +33,7 @@ + diff --git a/.idea/modules/common/PhoneProfilesPlus.common.main.iml b/.idea/modules/common/PhoneProfilesPlus.common.main.iml index e262bba600..857972a6d3 100644 --- a/.idea/modules/common/PhoneProfilesPlus.common.main.iml +++ b/.idea/modules/common/PhoneProfilesPlus.common.main.iml @@ -19,12 +19,14 @@ + + diff --git a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.main.iml b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.main.iml index 9d51d22a23..902c626ab8 100644 --- a/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.main.iml +++ b/.idea/modules/noobcameraflash/PhoneProfilesPlus.noobcameraflash.main.iml @@ -26,12 +26,14 @@ + + diff --git a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.main.iml b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.main.iml index aa2976c4f0..7da4e5afdd 100644 --- a/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.main.iml +++ b/.idea/modules/phoneProfilesPlus/PhoneProfilesPlus.phoneProfilesPlus.main.iml @@ -21,12 +21,14 @@ + + diff --git a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.main.iml b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.main.iml index 90f53cf60d..94f8920c84 100644 --- a/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.main.iml +++ b/.idea/modules/recyclerview-fastscroll/PhoneProfilesPlus.recyclerview-fastscroll.main.iml @@ -19,12 +19,14 @@ + + diff --git a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.main.iml b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.main.iml index 8141c7a08d..0156795e5e 100644 --- a/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.main.iml +++ b/.idea/modules/time-duration-picker/PhoneProfilesPlus.time-duration-picker.main.iml @@ -19,12 +19,14 @@ + + diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java index d8f221e648..0e5d844073 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ActivateProfileHelper.java @@ -2118,21 +2118,28 @@ private static boolean setTones(Context context, Profile profile, String[] splits = profile._soundRingtone.split(StringConstants.STR_SPLIT_REGEX); if (!splits[0].isEmpty()) { //Uri uri = Uri.parse(splits[0]); + //Log.e("ActivateProfileHelper.setTones (3)", "splits[0]="+splits[0]); Uri uri = getUriOfSavedTone(context, splits[0], RingtoneManager.TYPE_RINGTONE); - try { - ContentResolver contentResolver = context.getContentResolver(); - context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); - } catch (Exception e) { - // java.lang.SecurityException: UID 10157 does not have permission to - // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg - // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs - //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); + if (uri != null) { + //Log.e("ActivateProfileHelper.setTones (3)", "uri=" + uri); + try { + ContentResolver contentResolver = context.getContentResolver(); + context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); + } catch (Exception e) { + // java.lang.SecurityException: UID 10157 does not have permission to + // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg + // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs + //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } + Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); + //Log.e("ActivateProfileHelper.setTones (3)", "actualUri=" + actualUri); + if ((actualUri == null) || (!actualUri.equals(uri))) { + RingtoneManager.setActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE, uri); + //Log.e("ActivateProfileHelper.setTones (3)", "tone set"); + } } - Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE); - if ((actualUri == null) || (!actualUri.equals(uri))) - RingtoneManager.setActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_RINGTONE, uri); } } catch (IllegalArgumentException | IllegalStateException e) { @@ -2198,21 +2205,23 @@ private static boolean setTones(Context context, Profile profile, if (!splits[0].isEmpty()) { //Uri uri = Uri.parse(splits[0]); Uri uri = getUriOfSavedTone(context, splits[0], RingtoneManager.TYPE_NOTIFICATION); - try { - ContentResolver contentResolver = context.getContentResolver(); - context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); - } catch (Exception e) { - // java.lang.SecurityException: UID 10157 does not have permission to - // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg - // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs - //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); - } + if (uri != null) { + try { + ContentResolver contentResolver = context.getContentResolver(); + context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); + } catch (Exception e) { + // java.lang.SecurityException: UID 10157 does not have permission to + // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg + // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs + //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } - Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_NOTIFICATION); - if ((actualUri == null) || (!actualUri.equals(uri))) - RingtoneManager.setActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_NOTIFICATION, uri); + Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_NOTIFICATION); + if ((actualUri == null) || (!actualUri.equals(uri))) + RingtoneManager.setActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_NOTIFICATION, uri); + } } } catch (IllegalArgumentException | IllegalStateException e) { @@ -2275,20 +2284,22 @@ private static boolean setTones(Context context, Profile profile, if (!splits[0].isEmpty()) { //Uri uri = Uri.parse(splits[0]); Uri uri = getUriOfSavedTone(context, splits[0], RingtoneManager.TYPE_ALARM); - try { - ContentResolver contentResolver = context.getContentResolver(); - context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); - } catch (Exception e) { - // java.lang.SecurityException: UID 10157 does not have permission to - // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg - // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs - //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); + if (uri != null) { + try { + ContentResolver contentResolver = context.getContentResolver(); + context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); + } catch (Exception e) { + // java.lang.SecurityException: UID 10157 does not have permission to + // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg + // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs + //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } + Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_ALARM); + if ((actualUri == null) || (!actualUri.equals(uri))) + RingtoneManager.setActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_ALARM, uri); } - Uri actualUri = RingtoneManager.getActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_ALARM); - if ((actualUri == null) || (!actualUri.equals(uri))) - RingtoneManager.setActualDefaultRingtoneUri(appContext, RingtoneManager.TYPE_ALARM, uri); } } catch (IllegalArgumentException | IllegalStateException e) { @@ -2369,62 +2380,64 @@ private static boolean setTones(Context context, Profile profile, if (!splits[0].isEmpty()) { //Uri uri = Uri.parse(splits[0]); Uri uri = getUriOfSavedTone(context, splits[0], RingtoneManager.TYPE_RINGTONE); - try { - ContentResolver contentResolver = context.getContentResolver(); - context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); - // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ring tone granted"); - } catch (Exception e) { - // java.lang.SecurityException: UID 10157 does not have permission to - // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg - // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs - //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); - } + if (uri != null) { + try { + ContentResolver contentResolver = context.getContentResolver(); + context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ring tone granted"); + } catch (Exception e) { + // java.lang.SecurityException: UID 10157 does not have permission to + // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg + // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs + //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } - if ((PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) && (uri != null)) { - //Settings.System.putString(context.getContentResolver(), "ringtone_set", "1"); - //Settings.System.putString(context.getContentResolver(), "ringtone_2_set", "1"); + if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { + //Settings.System.putString(context.getContentResolver(), "ringtone_set", "1"); + //Settings.System.putString(context.getContentResolver(), "ringtone_2_set", "1"); - // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Samsung uri=" + uri.toString()); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Samsung uri=" + uri.toString()); - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { - } - String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_SAMSUNG); - if ((actualValue == null) || (!actualValue.equals(uri.toString()))) - Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_SAMSUNG, uri.toString()); - } else if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI) && (uri != null)) { - // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Huawei uri=" + uri.toString()); + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_SAMSUNG); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) + Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_SAMSUNG, uri.toString()); + } else if (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) { +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Huawei uri=" + uri.toString()); - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { - } - String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_HUAWEI); - if ((actualValue == null) || (!actualValue.equals(uri.toString()))) - Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_HUAWEI, uri.toString()); - } else if (PPApplication.deviceIsXiaomi && (PPApplication.romIsMIUI) && (uri != null)) { - // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Xiaomi uri=" + uri.toString()); + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_HUAWEI); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) + Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_HUAWEI, uri.toString()); + } else if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) { +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 Xiaomi uri=" + uri.toString()); - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { - } - String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_XIAOMI); - if ((actualValue == null) || (!actualValue.equals(uri.toString()))) - Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_XIAOMI, uri.toString()); - } else if (PPApplication.deviceIsOnePlus && (uri != null)) { -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 OnePlus uri=" + uri.toString()); + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_XIAOMI); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) + Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_XIAOMI, uri.toString()); + } else if (PPApplication.deviceIsOnePlus) { +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM1 OnePlus uri=" + uri.toString()); - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_ONEPLUS); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) + Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_ONEPLUS, uri.toString()); } - String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM1_ONEPLUS); - if ((actualValue == null) || (!actualValue.equals(uri.toString()))) - Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM1_ONEPLUS, uri.toString()); } } } @@ -2530,62 +2543,64 @@ private static boolean setTones(Context context, Profile profile, if (!splits[0].isEmpty()) { //Uri uri = Uri.parse(splits[0]); Uri uri = getUriOfSavedTone(context, splits[0], RingtoneManager.TYPE_RINGTONE); - try { - ContentResolver contentResolver = context.getContentResolver(); - context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ring tone granted"); - } catch (Exception e) { - // java.lang.SecurityException: UID 10157 does not have permission to - // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg - // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs - //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); - } + if (uri != null) { + try { + ContentResolver contentResolver = context.getContentResolver(); + context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ring tone granted"); + } catch (Exception e) { + // java.lang.SecurityException: UID 10157 does not have permission to + // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg + // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs + //Log.e("ActivateProfileHelper.setTones (1)", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } - if ((PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) && (uri != null)) { - //Settings.System.putString(context.getContentResolver(), "ringtone_set", "1"); - //Settings.System.putString(context.getContentResolver(), "ringtone_2_set", "1"); + if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { + //Settings.System.putString(context.getContentResolver(), "ringtone_set", "1"); + //Settings.System.putString(context.getContentResolver(), "ringtone_2_set", "1"); -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Samsung uri=" + uri.toString()); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Samsung uri=" + uri.toString()); - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { - } - String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_SAMSUNG); - if ((actualValue == null) || (!actualValue.equals(uri.toString()))) - Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_SAMSUNG, uri.toString()); - } else if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI) && (uri != null)) { -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Huawei uri=" + uri.toString()); + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_SAMSUNG); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) + Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_SAMSUNG, uri.toString()); + } else if (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) { +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Huawei uri=" + uri.toString()); - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { - } - String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_HUAWEI); - if ((actualValue == null) || (!actualValue.equals(uri.toString()))) - Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_HUAWEI, uri.toString()); - } else if (PPApplication.deviceIsXiaomi && (PPApplication.romIsMIUI) && (uri != null)) { -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Xiaomi uri=" + uri.toString()); + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_HUAWEI); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) + Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_HUAWEI, uri.toString()); + } else if (PPApplication.deviceIsXiaomi && PPApplication.romIsMIUI) { +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 Xiaomi uri=" + uri.toString()); - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { - } - String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_XIAOMI); - if ((actualValue == null) || (!actualValue.equals(uri.toString()))) - Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_XIAOMI, uri.toString()); - } else if (PPApplication.deviceIsOnePlus && (uri != null)) { -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 OnePlus uri=" + uri.toString()); + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_XIAOMI); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) + Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_XIAOMI, uri.toString()); + } else if (PPApplication.deviceIsOnePlus) { +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "ringtone SIM2 OnePlus uri=" + uri.toString()); - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_ONEPLUS); + if ((actualValue == null) || (!actualValue.equals(uri.toString()))) + Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_ONEPLUS, uri.toString()); } - String actualValue = Settings.System.getString(appContext.getContentResolver(), PREF_RINGTONE_SIM2_ONEPLUS); - if ((actualValue == null) || (!actualValue.equals(uri.toString()))) - Settings.System.putString(context.getContentResolver(), PREF_RINGTONE_SIM2_ONEPLUS, uri.toString()); } } } catch (IllegalArgumentException | IllegalStateException e) { @@ -2681,82 +2696,84 @@ private static boolean setTones(Context context, Profile profile, if (!splits[0].isEmpty()) { //Uri uri = Uri.parse(splits[0]); Uri uri = getUriOfSavedTone(context, splits[0], RingtoneManager.TYPE_NOTIFICATION); - try { - ContentResolver contentResolver = context.getContentResolver(); - context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification tone granted"); - } catch (Exception e) { - // java.lang.SecurityException: UID 10157 does not have permission to - // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg - // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs - //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); - } - - if ((PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) && (uri != null)) { - //Settings.System.putString(context.getContentResolver(), "ringtone_set", "1"); - //Settings.System.putString(context.getContentResolver(), "ringtone_2_set", "1"); - -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", " notification SIM1 Samsung uri="+uri.toString()); - + if (uri != null) { try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { + ContentResolver contentResolver = context.getContentResolver(); + context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification tone granted"); + } catch (Exception e) { + // java.lang.SecurityException: UID 10157 does not have permission to + // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg + // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs + //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); } - //Settings.System.putString(context.getContentResolver(), "notification_sound", uri.toString()); + if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { + //Settings.System.putString(context.getContentResolver(), "ringtone_set", "1"); + //Settings.System.putString(context.getContentResolver(), "ringtone_2_set", "1"); - if (isPPPPutSettingsInstalled(appContext) > 0) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_SAMSUNG, uri.toString()); - } else { - if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && - (RootUtils.isRooted(/*false*/) && RootUtils.settingsBinaryExists(false))) { -// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setTones", "(1) PPApplication.rootMutex"); - synchronized (PPApplication.rootMutex) { - String command1; - Command command; - command1 = COMMAND_SETTINGS_PUT_SYSTEM+PREF_NOTIFICATION_SIM1_SAMSUNG + " " + uri.toString(); - command = new Command(0, /*false,*/ command1); - try { - RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); - RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_TONES); -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification for SIM 1 with root"); - } catch (Exception e) { - // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied - //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", " notification SIM1 Samsung uri="+uri.toString()); + + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + + //Settings.System.putString(context.getContentResolver(), "notification_sound", uri.toString()); + + if (isPPPPutSettingsInstalled(appContext) > 0) { + putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_SAMSUNG, uri.toString()); + } else { + if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && + (RootUtils.isRooted(/*false*/) && RootUtils.settingsBinaryExists(false))) { +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setTones", "(1) PPApplication.rootMutex"); + synchronized (PPApplication.rootMutex) { + String command1; + Command command; + command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM1_SAMSUNG + " " + uri.toString(); + command = new Command(0, /*false,*/ command1); + try { + RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); + RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_TONES); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification for SIM 1 with root"); + } catch (Exception e) { + // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied + //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } } } } - } - } else if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI) && (uri != null)) { -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification SIM1 Huawei uri="+uri.toString()); + } else if (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) { +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification SIM1 Huawei uri="+uri.toString()); - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { - } + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } - if (isPPPPutSettingsInstalled(appContext) > 0) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_HUAWEI, uri.toString()); - } else { - if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && - (RootUtils.isRooted(/*false*/) && RootUtils.settingsBinaryExists(false))) { -// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setTones", "(2) PPApplication.rootMutex"); - synchronized (PPApplication.rootMutex) { - String command1; - Command command; - command1 = COMMAND_SETTINGS_PUT_SYSTEM+PREF_NOTIFICATION_SIM1_HUAWEI + " " + uri.toString(); - command = new Command(0, /*false,*/ command1); - try { - RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); - RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_TONES); -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification for SIM 1 with root"); - } catch (Exception e) { - // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied - //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); + if (isPPPPutSettingsInstalled(appContext) > 0) { + putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM1_HUAWEI, uri.toString()); + } else { + if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && + (RootUtils.isRooted(/*false*/) && RootUtils.settingsBinaryExists(false))) { +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setTones", "(2) PPApplication.rootMutex"); + synchronized (PPApplication.rootMutex) { + String command1; + Command command; + command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM1_HUAWEI + " " + uri.toString(); + command = new Command(0, /*false,*/ command1); + try { + RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); + RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_TONES); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification for SIM 1 with root"); + } catch (Exception e) { + // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied + //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } } } } @@ -2772,30 +2789,30 @@ private static boolean setTones(Context context, Profile profile, PPApplicationStatic.addActivityLog(appContext, PPApplication.ALTYPE_PROFILE_ERROR_SET_TONE_NOTIFICATION, null, profile._name, ""); noError = false; - /*String[] splits = profile._soundNotification.split(StringConstants.STR_SPLIT_REGEX); - if (!splits[0].isEmpty()) { - try { - boolean found = false; - RingtoneManager manager = new RingtoneManager(context); - Cursor cursor = manager.getCursor(); - while (cursor.moveToNext()) { - String _uri = cursor.getString(RingtoneManager.URI_COLUMN_INDEX); - if (_uri.equals(splits[0])) { - // uri exists in RingtoneManager - found = true; - break; + /*String[] splits = profile._soundNotification.split(StringConstants.STR_SPLIT_REGEX); + if (!splits[0].isEmpty()) { + try { + boolean found = false; + RingtoneManager manager = new RingtoneManager(context); + Cursor cursor = manager.getCursor(); + while (cursor.moveToNext()) { + String _uri = cursor.getString(RingtoneManager.URI_COLUMN_INDEX); + if (_uri.equals(splits[0])) { + // uri exists in RingtoneManager + found = true; + break; + } } - } - if (found) { + if (found) { + PPApplication.setCustomKey("ActivateProfileHelper_setTone", splits[0]); + PPApplicationStatic.recordException(e); + } + } catch (Exception ee) { PPApplication.setCustomKey("ActivateProfileHelper_setTone", splits[0]); PPApplicationStatic.recordException(e); } - } catch (Exception ee) { - PPApplication.setCustomKey("ActivateProfileHelper_setTone", splits[0]); - PPApplicationStatic.recordException(e); - } - } else - PPApplicationStatic.recordException(e);*/ + } else + PPApplicationStatic.recordException(e);*/ } } else { // selected is None tone @@ -2896,88 +2913,90 @@ private static boolean setTones(Context context, Profile profile, if (!splits[0].isEmpty()) { //Uri uri = Uri.parse(splits[0]); Uri uri = getUriOfSavedTone(context, splits[0], RingtoneManager.TYPE_NOTIFICATION); - try { - ContentResolver contentResolver = context.getContentResolver(); - context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); - contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification tone granted"); - } catch (Exception e) { - // java.lang.SecurityException: UID 10157 does not have permission to - // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg - // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs - //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); - } - - if ((PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) && (uri != null)) { - //Settings.System.putString(context.getContentResolver(), "ringtone_set", "1"); - //Settings.System.putString(context.getContentResolver(), "ringtone_2_set", "1"); - -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", " notification SIM2 Samsung uri="+uri.toString()); - + if (uri != null) { try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { + ContentResolver contentResolver = context.getContentResolver(); + context.grantUriPermission(PPApplication.PACKAGE_NAME, uri, Intent.FLAG_GRANT_READ_URI_PERMISSION | Intent.FLAG_GRANT_PERSISTABLE_URI_PERMISSION); + contentResolver.takePersistableUriPermission(uri, Intent.FLAG_GRANT_READ_URI_PERMISSION); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification tone granted"); + } catch (Exception e) { + // java.lang.SecurityException: UID 10157 does not have permission to + // content://com.android.externalstorage.documents/document/93ED-1CEC%3AMirek%2Fmobil%2F.obr%C3%A1zek%2Fblack.jpg + // [user 0]; you could obtain access using ACTION_OPEN_DOCUMENT or related APIs + //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); } - //Settings.System.putString(context.getContentResolver(), "notification_sound_2", uri.toString()); + if (PPApplication.deviceIsSamsung && PPApplication.romIsGalaxy) { + //Settings.System.putString(context.getContentResolver(), "ringtone_set", "1"); + //Settings.System.putString(context.getContentResolver(), "ringtone_2_set", "1"); - if (isPPPPutSettingsInstalled(appContext) > 0) { - putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM2_SAMSUNG, uri.toString()); - } else { - if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && - (RootUtils.isRooted(/*false*/) && RootUtils.settingsBinaryExists(false))) { -// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setTones", "(5) PPApplication.rootMutex"); - synchronized (PPApplication.rootMutex) { - String command1; - Command command; - command1 = COMMAND_SETTINGS_PUT_SYSTEM+PREF_NOTIFICATION_SIM2_SAMSUNG + " " + uri.toString(); - command = new Command(0, /*false,*/ command1); - try { - RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); - RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_TONES); -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification for SIM 2 with root"); - } catch (Exception e) { - // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied - //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); - } - } +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", " notification SIM2 Samsung uri="+uri.toString()); + + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { } - } - } else if (PPApplication.deviceIsHuawei && (PPApplication.romIsEMUI) && (uri != null)) { - try { - uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); - } catch (Exception ignored) { - } - // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification SIM2 Huawei uri="+uri.toString()); - if (ShizukuUtils.hasShizukuPermission()) { - synchronized (PPApplication.rootMutex) { - String command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM2_HUAWEI + " " + uri.toString(); - try { - ShizukuUtils.executeCommand(command1); - } catch (Exception e) { - //Log.e("ActivateProfileHelper.setMobileData", Log.getStackTraceString(e)); + //Settings.System.putString(context.getContentResolver(), "notification_sound_2", uri.toString()); + + if (isPPPPutSettingsInstalled(appContext) > 0) { + putSettingsParameter(context, PPPPS_SETTINGS_TYPE_SYSTEM, PREF_NOTIFICATION_SIM2_SAMSUNG, uri.toString()); + } else { + if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && + (RootUtils.isRooted(/*false*/) && RootUtils.settingsBinaryExists(false))) { +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setTones", "(5) PPApplication.rootMutex"); + synchronized (PPApplication.rootMutex) { + String command1; + Command command; + command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM2_SAMSUNG + " " + uri.toString(); + command = new Command(0, /*false,*/ command1); + try { + RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); + RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_TONES); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification for SIM 2 with root"); + } catch (Exception e) { + // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied + //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } + } } } - } else { - if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && - (RootUtils.isRooted(/*false*/) && RootUtils.settingsBinaryExists(false))) { -// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setTones", "(6) PPApplication.rootMutex"); + } else if (PPApplication.deviceIsHuawei && PPApplication.romIsEMUI) { + try { + uri = ContentProvider.maybeAddUserId(uri, context.getUserId()); + } catch (Exception ignored) { + } + + // PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification SIM2 Huawei uri="+uri.toString()); + if (ShizukuUtils.hasShizukuPermission()) { synchronized (PPApplication.rootMutex) { - String command1; - Command command; - command1 = COMMAND_SETTINGS_PUT_SYSTEM+PREF_NOTIFICATION_SIM2_HUAWEI + " " + uri.toString(); - command = new Command(0, /*false,*/ command1); + String command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM2_HUAWEI + " " + uri.toString(); try { - RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); - RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_TONES); -// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification for SIM2 with root"); + ShizukuUtils.executeCommand(command1); } catch (Exception e) { - // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied - //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); - //PPApplicationStatic.recordException(e); + //Log.e("ActivateProfileHelper.setMobileData", Log.getStackTraceString(e)); + } + } + } else { + if ((!ApplicationPreferences.applicationNeverAskForGrantRoot) && + (RootUtils.isRooted(/*false*/) && RootUtils.settingsBinaryExists(false))) { +// PPApplicationStatic.logE("[SYNCHRONIZED] ActivateProfileHelper.setTones", "(6) PPApplication.rootMutex"); + synchronized (PPApplication.rootMutex) { + String command1; + Command command; + command1 = COMMAND_SETTINGS_PUT_SYSTEM + PREF_NOTIFICATION_SIM2_HUAWEI + " " + uri.toString(); + command = new Command(0, /*false,*/ command1); + try { + RootTools.getShell(true, Shell.ShellContext.SYSTEM_APP).add(command); + RootUtils.commandWait(command, RootCommandWaitCalledFromConstants.ROOT_COMMAND_WAIT_CALLED_FROM_SET_TONES); +// PPApplicationStatic.logE("[DUAL_SIM] ActivateProfileHelper.setTones", "notification for SIM2 with root"); + } catch (Exception e) { + // com.stericson.rootshell.exceptions.RootDeniedException: Root Access Denied + //Log.e("ActivateProfileHelper.setTones", Log.getStackTraceString(e)); + //PPApplicationStatic.recordException(e); + } } } } @@ -2993,30 +3012,30 @@ private static boolean setTones(Context context, Profile profile, PPApplicationStatic.addActivityLog(appContext, PPApplication.ALTYPE_PROFILE_ERROR_SET_TONE_NOTIFICATION, null, profile._name, ""); noError = false; - /*String[] splits = profile._soundNotification.split(StringConstants.STR_SPLIT_REGEX); - if (!splits[0].isEmpty()) { - try { - boolean found = false; - RingtoneManager manager = new RingtoneManager(context); - Cursor cursor = manager.getCursor(); - while (cursor.moveToNext()) { - String _uri = cursor.getString(RingtoneManager.URI_COLUMN_INDEX); - if (_uri.equals(splits[0])) { - // uri exists in RingtoneManager - found = true; - break; + /*String[] splits = profile._soundNotification.split(StringConstants.STR_SPLIT_REGEX); + if (!splits[0].isEmpty()) { + try { + boolean found = false; + RingtoneManager manager = new RingtoneManager(context); + Cursor cursor = manager.getCursor(); + while (cursor.moveToNext()) { + String _uri = cursor.getString(RingtoneManager.URI_COLUMN_INDEX); + if (_uri.equals(splits[0])) { + // uri exists in RingtoneManager + found = true; + break; + } } - } - if (found) { + if (found) { + PPApplication.setCustomKey("ActivateProfileHelper_setTone", splits[0]); + PPApplicationStatic.recordException(e); + } + } catch (Exception ee) { PPApplication.setCustomKey("ActivateProfileHelper_setTone", splits[0]); PPApplicationStatic.recordException(e); } - } catch (Exception ee) { - PPApplication.setCustomKey("ActivateProfileHelper_setTone", splits[0]); - PPApplicationStatic.recordException(e); - } - } else - PPApplicationStatic.recordException(e);*/ + } else + PPApplicationStatic.recordException(e);*/ } } else { // selected is None tone From eee8134f649880e3f89ac921d0967addfbd5edb4 Mon Sep 17 00:00:00 2001 From: henrichg Date: Tue, 20 Feb 2024 11:24:29 +0100 Subject: [PATCH 09/19] =?UTF-8?q?Fix:=20java.lang.IllegalStateException:?= =?UTF-8?q?=20You=20are=20adding=20too=20many=20system=20=E2=80=A6=20?= =?UTF-8?q?=E2=80=A6settings.=20You=20should=20stop=20using=20system=20set?= =?UTF-8?q?tings=20for=20app=20specific=20data=20package:=20sk.henrichg.ph?= =?UTF-8?q?oneprofilesplus=20(2)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ScreenOnOffBroadcastReceiver.java | 47 ++++++++++--------- 1 file changed, 24 insertions(+), 23 deletions(-) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ScreenOnOffBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ScreenOnOffBroadcastReceiver.java index ea73965858..22e4628e69 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ScreenOnOffBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/ScreenOnOffBroadcastReceiver.java @@ -88,31 +88,32 @@ public void onReceive(Context context, Intent intent) { try { PPApplication.brightnessInternalChange = true; if (profile.getDeviceBrightnessAutomatic()) { - Settings.System.putInt(appContext.getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS_MODE, - Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); - //if (ProfileStatic.isProfilePreferenceAllowed(Profile.PREF_PROFILE_DEVICE_ADAPTIVE_BRIGHTNESS, null, null, false, appContext).allowed - // == PreferenceAllowed.PREFERENCE_ALLOWED) { + if (Settings.System.getInt(appContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS_MODE, -1) != Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC) Settings.System.putInt(appContext.getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS, - profile.getDeviceBrightnessManualValue(appContext)); -// try { -// Settings.System.putFloat(appContext.getContentResolver(), -// Settings.System.SCREEN_AUTO_BRIGHTNESS_ADJ, -// profile.getDeviceBrightnessAdaptiveValue(appContext)); -// } catch (Exception ee) { -// ActivateProfileHelper.executeRootForAdaptiveBrightness( -// profile.getDeviceBrightnessAdaptiveValue(appContext), -// appContext); -// } - //} + Settings.System.SCREEN_BRIGHTNESS_MODE, + Settings.System.SCREEN_BRIGHTNESS_MODE_AUTOMATIC); + if (profile.getDeviceBrightnessChangeLevel()) { + int newBrightness = profile.getDeviceBrightnessManualValue(appContext); + if (Settings.System.getInt(appContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS, -1) != newBrightness) + Settings.System.putInt(appContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS, newBrightness); + } } else { - Settings.System.putInt(appContext.getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS_MODE, - Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); - Settings.System.putInt(appContext.getContentResolver(), - Settings.System.SCREEN_BRIGHTNESS, - profile.getDeviceBrightnessManualValue(appContext)); + if (Settings.System.getInt(appContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS_MODE, -1) != + Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL) + Settings.System.putInt(appContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS_MODE, + Settings.System.SCREEN_BRIGHTNESS_MODE_MANUAL); + if (profile.getDeviceBrightnessChangeLevel()) { + int newBrightness = profile.getDeviceBrightnessManualValue(appContext); + if (Settings.System.getInt(appContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS, -1) != newBrightness) + Settings.System.putInt(appContext.getContentResolver(), + Settings.System.SCREEN_BRIGHTNESS, newBrightness); + } } PPExecutors.scheduleDisableBrightnessInternalChangeExecutor(); } catch (Exception ignored) { From 5343d64a1c0fb33e5de88fd9000e9e3fa7516834 Mon Sep 17 00:00:00 2001 From: henrichg Date: Tue, 20 Feb 2024 13:25:28 +0100 Subject: [PATCH 10/19] Test: Test of BT sensor - disconnect car. --- dependencies.gradle | 4 +-- .../BluetoothConnectionBroadcastReceiver.java | 26 ++++++++----------- .../EventPreferencesBluetooth.java | 4 ++- .../phoneprofilesplus/PPApplication.java | 5 ++-- 4 files changed, 19 insertions(+), 20 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index 4b5cbfa8c2..cac458214f 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -35,9 +35,9 @@ // 7090 = Removed support for Galaxy Store ext.ppVersions = [ - publishVersion : '6.4.1', + publishVersion : '6.4.1.1b', - publishVersionCode: 7110, + publishVersionCode: 7111, minSdk : 26, targetSdk : 28, diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java index 3193d2fbb5..f94a88ab56 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java @@ -47,18 +47,20 @@ public void onReceive(Context context, Intent intent) { action.equals(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED)) { // BluetoothConnectionBroadcastReceiver -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "action="+action); + PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "action="+action); // Log.e("BluetoothConnectionBroadcastReceiver.onReceive", "[2] action="+action); BluetoothDevice _device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+device); + PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device); + if (_device != null) + PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device.getName()); //if (device == null) // return; //final boolean connected = action.equals(BluetoothDevice.ACTION_ACL_CONNECTED); final String newName = intent.getStringExtra(BluetoothDevice.EXTRA_NAME); -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "newName="+newName); + PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "newName="+newName); // this is important, because ACTION_NAME_CHANGED is called very often if (action.equals(BluetoothDevice.ACTION_NAME_CHANGED)) { @@ -74,11 +76,10 @@ public void onReceive(Context context, Intent intent) { } } -// if (device != null) { -//// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+device.getName()); -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.name=" + device.getName()); -// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.address=" + device.getAddress()); -// } + if (_device != null) { + PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.name=" + _device.getName()); + PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.address=" + _device.getAddress()); + } final Context appContext = context.getApplicationContext(); final WeakReference deviceWeakRef = new WeakReference<>(_device); @@ -123,14 +124,8 @@ public void onReceive(Context context, Intent intent) { saveConnectedDevices(appContext); - // !! do not call this, some BT devices are not detected :-( -// Log.e("BluetoothConnectionBroadcastReceiver.onReceive", "**** START of getConnectedDevices"); - // is needed to call event hander -// BluetoothConnectedDevicesDetector.getConnectedDevices(appContext, true); - callEventHandler(appContext); } - //} } catch (Exception e) { // PPApplicationStatic.logE("[IN_EXECUTOR] PPApplication.startHandlerThread", Log.getStackTraceString(e)); @@ -292,6 +287,7 @@ private static void removeConnectedDevice(BluetoothDevice device) } } } + PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.removeConnectedDevice", "device="+device.getName()); if (found) //connectedDevices.remove(index); connectedDevices.remove(deviceToRemove); @@ -405,7 +401,7 @@ static boolean isBluetoothConnected(BluetoothDeviceData deviceData, String senso // PPApplicationStatic.logE("[SYNCHRONIZED] BluetoothConnectionBroadcastReceiver.isBluetoothConnected", "PPApplication.bluetoothConnectionChangeStateMutex"); synchronized (PPApplication.bluetoothConnectionChangeStateMutex) { if ((deviceData == null) && sensorDeviceName.isEmpty()) { - // is device connected to any external bluetooth device ??? + // is device connected to any external bluetooth device ??? return (connectedDevices != null) && (connectedDevices.size() > 0); } diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java index c100d46cc5..0736f31fe5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java @@ -486,7 +486,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { BluetoothConnectionBroadcastReceiver.getConnectedDevices(eventsHandler.context); if (BluetoothConnectionBroadcastReceiver.isBluetoothConnected(null, "")) { - //if (BluetoothConnectedDevicesDetector.isBluetoothConnected(connectedDevices,null, "")) { + PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is connected"); String[] splits = _adapterName.split(StringConstants.STR_SPLIT_REGEX); boolean[] connected = new boolean[splits.length]; @@ -539,6 +539,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { done = true; } } else { + PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is NOT connected"); if ((_connectionType == EventPreferencesBluetooth.CTYPE_CONNECTED) || (_connectionType == EventPreferencesBluetooth.CTYPE_NOT_CONNECTED)) { // not use scanner data @@ -546,6 +547,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { eventsHandler.bluetoothPassed = (_connectionType == EventPreferencesBluetooth.CTYPE_NOT_CONNECTED); } } + PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "eventsHandler.bluetoothPassed="+eventsHandler.bluetoothPassed); } else { if ((_connectionType == EventPreferencesBluetooth.CTYPE_CONNECTED) || (_connectionType == EventPreferencesBluetooth.CTYPE_NOT_CONNECTED)) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java index 7bd0d6e83a..5d2fc378ec 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java @@ -178,7 +178,7 @@ public class PPApplication extends Application @SuppressWarnings("PointlessBooleanExpression") static final boolean logIntoLogCat = true && DebugVersion.enabled; //TODO change it back to not log crash for releases - static final boolean logIntoFile = false; + static final boolean logIntoFile = true; @SuppressWarnings("PointlessBooleanExpression") static final boolean crashIntoFile = false && DebugVersion.enabled; static final boolean rootToolsDebug = false; @@ -233,7 +233,7 @@ public class PPApplication extends Application // +"|[WORKER_CALL]" // +"|[IN_EXECUTOR]" // +"|[EXECUTOR_CALL]" -// +"|[IN_BROADCAST]" + +"|[IN_BROADCAST]" // +"|[IN_BROADCAST_ALARM]" // +"|[LOCAL_BROADCAST_CALL]" // +"|[IN_OBSERVER]" @@ -273,6 +273,7 @@ public class PPApplication extends Application //+"|[RINGING_SIMULATION]" //+"|BluetoothConnectedDevicesDetector" //+"|BluetoothConnectionBroadcastReceiver" + +"|EventPreferencesBluetooth" //+"|CheckCriticalPPPReleasesBroadcastReceiver" ; From 7a0e95aa5338dae69a5281ccb5569f6a91fec4d8 Mon Sep 17 00:00:00 2001 From: henrichg Date: Tue, 20 Feb 2024 19:20:19 +0100 Subject: [PATCH 11/19] Test: Test of BT sensor - disconnect car. (2) --- .../BluetoothConnectionBroadcastReceiver.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java index f94a88ab56..e734612ba5 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java @@ -141,8 +141,8 @@ public void onReceive(Context context, Intent intent) { } }; PPApplicationStatic.createEventsHandlerExecutor(); - //PPApplication.eventsHandlerExecutor.submit(runnable); - PPApplication.delayedEventsHandlerExecutor.schedule(runnable, 15, TimeUnit.SECONDS); + PPApplication.eventsHandlerExecutor.submit(runnable); + //PPApplication.delayedEventsHandlerExecutor.schedule(runnable, 15, TimeUnit.SECONDS); } } From af4ac5179f99839255938cccf578175627fff07b Mon Sep 17 00:00:00 2001 From: henrichg Date: Tue, 20 Feb 2024 19:57:39 +0100 Subject: [PATCH 12/19] Test: Test of BT sensor - disconnect car. (3) --- cospravit.txt | 58 +++++++++++++++++++++++++++++++++++++++++++++ dependencies.gradle | 2 +- 2 files changed, 59 insertions(+), 1 deletion(-) diff --git a/cospravit.txt b/cospravit.txt index af341d4cad..d5bbf50125 100644 --- a/cospravit.txt +++ b/cospravit.txt @@ -496,6 +496,64 @@ https://developer.android.com/develop/connectivity/nfc/nfc#ext-type - Fixed bugs. - Updated translations. +-------------------------------- + +Prisiel disconnect: +12:33:41.718 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: action=android.bluetooth.device.action.ACL_DISCONNECTED +12:33:41.722 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: device=38:01:95:01:2B:2A +12:33:41.723 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: newName=null +12:33:41.734 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: [2] device.name=[Samsung] Soundbar J-Series +12:33:41.734 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: [2] device.address=38:01:95:01:2B:2A + +Toto je events handler z ineho senzora: +12:33:48.305 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected +12:33:48.305 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true +12:33:48.332 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected +12:33:48.333 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true + +Toot je events handler z BT connection broadcastu: +12:34:06.977 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected +12:34:06.978 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false +12:34:07.064 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected +12:34:07.065 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false + +------ + +Vypol som sound bar, neviem kto toto volal, hm, hm: +12:45:02.527 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected +12:45:02.531 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true +12:45:02.573 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected +12:45:02.577 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true + +Volanie remove z broadcastu: +12:45:13.823 [IN_BROADCAST] B...eConnectedDevice E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.removeConnectedDevice ]: device=[Samsung] Soundbar J-Series +Volanie handlera z broadcastu +12:45:24.148 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected +12:45:24.150 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false +12:45:24.302 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected +12:45:24.303 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false + +Cize to vypada, ze to funguje. Teda aspon so soundbarom. +Takze pozi toto uzivatelovi, nech to testne s autom. + +----------------------------- + +connected: +CC 9048 v21 + CarBt_159676 + +20.02.24 16:09:03:3 [ E ] [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected +20.02.24 16:09:03:4 [ E ] [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true + +disconected: + CarBt_159676 +CC 9048 v21 + +20.02.24 17:25:40:0 [ E ] [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected +20.02.24 17:25:40:0 [ E ] [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false + +--- + diff --git a/dependencies.gradle b/dependencies.gradle index cac458214f..f0f9e9ff4d 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -37,7 +37,7 @@ ext.ppVersions = [ publishVersion : '6.4.1.1b', - publishVersionCode: 7111, + publishVersionCode: 7112, minSdk : 26, targetSdk : 28, From fd5f4249d59cebad2004af960fb0cd65c47e7ac0 Mon Sep 17 00:00:00 2001 From: henrichg Date: Wed, 21 Feb 2024 16:39:12 +0100 Subject: [PATCH 13/19] ... --- .../sk/henrichg/phoneprofilesplus/PPApplication.java | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java index 5d2fc378ec..8293d11285 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java @@ -1930,7 +1930,7 @@ private static boolean isMIUIROM() { PPApplicationStatic.recordException(ex); } - return miuiRom1 || miuiRom2 || miuiRom3; + return isXiaomi() && (miuiRom1 || miuiRom2 || miuiRom3); } /** @noinspection BlockingMethodInNonBlockingContext*/ @@ -1960,8 +1960,11 @@ private static boolean isHuawei() { private static boolean isEMUIROM() { String emuiRomName = getEmuiRomName(); - return (emuiRomName.length() != 0) || - Build.DISPLAY.toLowerCase().contains("emui2.3");// || "EMUI 2.3".equalsIgnoreCase(emuiRomName); + return isHuawei() && + ( + (emuiRomName.length() != 0) || + Build.DISPLAY.toLowerCase().contains("emui2.3")// || "EMUI 2.3".equalsIgnoreCase(emuiRomName); + ); } private static boolean isSamsung() { @@ -2004,7 +2007,7 @@ private static boolean isGalaxyROM() { else return true; // OneUI ROM */ - return true; + return isSamsung(); } catch (Exception e) { return false; } From e27af7548b60edbd30643b7b1af07971d64c293f Mon Sep 17 00:00:00 2001 From: henrichg Date: Wed, 21 Feb 2024 22:49:41 +0100 Subject: [PATCH 14/19] Test: Test of BT sensor - disconnect car. (4) --- dependencies.gradle | 2 +- .../henrichg/phoneprofilesplus/EventPreferencesBluetooth.java | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dependencies.gradle b/dependencies.gradle index f0f9e9ff4d..b3dbde2892 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -37,7 +37,7 @@ ext.ppVersions = [ publishVersion : '6.4.1.1b', - publishVersionCode: 7112, + publishVersionCode: 7113, minSdk : 26, targetSdk : 28, diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java index 0736f31fe5..f9489aa5a1 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java @@ -486,7 +486,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { BluetoothConnectionBroadcastReceiver.getConnectedDevices(eventsHandler.context); if (BluetoothConnectionBroadcastReceiver.isBluetoothConnected(null, "")) { - PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is connected"); + PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is connected event="+_event._name); String[] splits = _adapterName.split(StringConstants.STR_SPLIT_REGEX); boolean[] connected = new boolean[splits.length]; @@ -539,7 +539,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { done = true; } } else { - PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is NOT connected"); + PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is NOT connected event="+_event._name); if ((_connectionType == EventPreferencesBluetooth.CTYPE_CONNECTED) || (_connectionType == EventPreferencesBluetooth.CTYPE_NOT_CONNECTED)) { // not use scanner data From 28716ffe8fa2ecce79c5b3f7b7e00d27b1465b6e Mon Sep 17 00:00:00 2001 From: henrichg Date: Thu, 22 Feb 2024 10:35:08 +0100 Subject: [PATCH 15/19] Change: Added touch click sound for bottom navigator in Editor. --- .../java/sk/henrichg/phoneprofilesplus/EditorActivity.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorActivity.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorActivity.java index 9e7808c786..830c307e3d 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorActivity.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EditorActivity.java @@ -33,6 +33,7 @@ import android.view.LayoutInflater; import android.view.Menu; import android.view.MenuItem; +import android.view.SoundEffectConstants; import android.view.SubMenu; import android.view.View; import android.view.ViewTreeObserver; @@ -418,7 +419,10 @@ public void onDrawerOpened(View drawerView) { bottomNavigationView = findViewById(R.id.editor_list_bottom_navigation); bottomNavigationView.setOnItemSelectedListener( - EditorActivity.this::selectViewItem + (me.ibrahimsn.lib.OnItemSelectedListener) item -> { + bottomNavigationView.playSoundEffect(SoundEffectConstants.CLICK); + return EditorActivity.this.selectViewItem(item); + } ); // set size of icons of BottomNavigationView /*BottomNavigationMenuView menuView = (BottomNavigationMenuView) bottomNavigationView.getChildAt(0); From 0baa41113b4758be819a618bc76697ee450b5842 Mon Sep 17 00:00:00 2001 From: henrichg Date: Fri, 23 Feb 2024 09:44:52 +0100 Subject: [PATCH 16/19] Fix: Bad working BT connection broadcast receiver. --- cospravit.txt | 59 ------------------- dependencies.gradle | 2 +- .../BluetoothConnectionBroadcastReceiver.java | 20 +++---- .../EventPreferencesBluetooth.java | 6 +- .../phoneprofilesplus/PPApplication.java | 6 +- 5 files changed, 17 insertions(+), 76 deletions(-) diff --git a/cospravit.txt b/cospravit.txt index d5bbf50125..9edfb20f5e 100644 --- a/cospravit.txt +++ b/cospravit.txt @@ -498,62 +498,3 @@ https://developer.android.com/develop/connectivity/nfc/nfc#ext-type -------------------------------- -Prisiel disconnect: -12:33:41.718 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: action=android.bluetooth.device.action.ACL_DISCONNECTED -12:33:41.722 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: device=38:01:95:01:2B:2A -12:33:41.723 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: newName=null -12:33:41.734 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: [2] device.name=[Samsung] Soundbar J-Series -12:33:41.734 [IN_BROADCAST] B...ceiver.onReceive E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive ]: [2] device.address=38:01:95:01:2B:2A - -Toto je events handler z ineho senzora: -12:33:48.305 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected -12:33:48.305 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true -12:33:48.332 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected -12:33:48.333 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true - -Toot je events handler z BT connection broadcastu: -12:34:06.977 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected -12:34:06.978 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false -12:34:07.064 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected -12:34:07.065 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false - ------- - -Vypol som sound bar, neviem kto toto volal, hm, hm: -12:45:02.527 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected -12:45:02.531 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true -12:45:02.573 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected -12:45:02.577 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true - -Volanie remove z broadcastu: -12:45:13.823 [IN_BROADCAST] B...eConnectedDevice E [ [IN_BROADCAST] BluetoothConnectionBroadcastReceiver.removeConnectedDevice ]: device=[Samsung] Soundbar J-Series -Volanie handlera z broadcastu -12:45:24.148 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected -12:45:24.150 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false -12:45:24.302 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected -12:45:24.303 EventPreferences...th.doHandleEvent E [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false - -Cize to vypada, ze to funguje. Teda aspon so soundbarom. -Takze pozi toto uzivatelovi, nech to testne s autom. - ------------------------------ - -connected: -CC 9048 v21 - CarBt_159676 - -20.02.24 16:09:03:3 [ E ] [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is connected -20.02.24 16:09:03:4 [ E ] [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=true - -disconected: - CarBt_159676 -CC 9048 v21 - -20.02.24 17:25:40:0 [ E ] [ EventPreferencesBluetooth.doHandleEvent ]: bluetooth is NOT connected -20.02.24 17:25:40:0 [ E ] [ EventPreferencesBluetooth.doHandleEvent ]: eventsHandler.bluetoothPassed=false - ---- - - - - diff --git a/dependencies.gradle b/dependencies.gradle index b3dbde2892..ec08787d48 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -37,7 +37,7 @@ ext.ppVersions = [ publishVersion : '6.4.1.1b', - publishVersionCode: 7113, + publishVersionCode: 7114, minSdk : 26, targetSdk : 28, diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java index e734612ba5..492f6d3006 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java @@ -47,20 +47,20 @@ public void onReceive(Context context, Intent intent) { action.equals(BluetoothDevice.ACTION_ACL_DISCONNECT_REQUESTED)) { // BluetoothConnectionBroadcastReceiver - PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "action="+action); +// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "action="+action); // Log.e("BluetoothConnectionBroadcastReceiver.onReceive", "[2] action="+action); BluetoothDevice _device = intent.getParcelableExtra(BluetoothDevice.EXTRA_DEVICE); - PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device); - if (_device != null) - PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device.getName()); +// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device); +// if (_device != null) +// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "device="+_device.getName()); //if (device == null) // return; //final boolean connected = action.equals(BluetoothDevice.ACTION_ACL_CONNECTED); final String newName = intent.getStringExtra(BluetoothDevice.EXTRA_NAME); - PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "newName="+newName); +// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "newName="+newName); // this is important, because ACTION_NAME_CHANGED is called very often if (action.equals(BluetoothDevice.ACTION_NAME_CHANGED)) { @@ -76,10 +76,10 @@ public void onReceive(Context context, Intent intent) { } } - if (_device != null) { - PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.name=" + _device.getName()); - PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.address=" + _device.getAddress()); - } +// if (_device != null) { +// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.name=" + _device.getName()); +// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.onReceive", "[2] device.address=" + _device.getAddress()); +// } final Context appContext = context.getApplicationContext(); final WeakReference deviceWeakRef = new WeakReference<>(_device); @@ -287,7 +287,7 @@ private static void removeConnectedDevice(BluetoothDevice device) } } } - PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.removeConnectedDevice", "device="+device.getName()); +// PPApplicationStatic.logE("[IN_BROADCAST] BluetoothConnectionBroadcastReceiver.removeConnectedDevice", "device="+device.getName()); if (found) //connectedDevices.remove(index); connectedDevices.remove(deviceToRemove); diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java index f9489aa5a1..8c4f9b3738 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/EventPreferencesBluetooth.java @@ -486,7 +486,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { BluetoothConnectionBroadcastReceiver.getConnectedDevices(eventsHandler.context); if (BluetoothConnectionBroadcastReceiver.isBluetoothConnected(null, "")) { - PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is connected event="+_event._name); +// PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is connected event="+_event._name); String[] splits = _adapterName.split(StringConstants.STR_SPLIT_REGEX); boolean[] connected = new boolean[splits.length]; @@ -539,7 +539,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { done = true; } } else { - PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is NOT connected event="+_event._name); +// PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "bluetooth is NOT connected event="+_event._name); if ((_connectionType == EventPreferencesBluetooth.CTYPE_CONNECTED) || (_connectionType == EventPreferencesBluetooth.CTYPE_NOT_CONNECTED)) { // not use scanner data @@ -547,7 +547,7 @@ void doHandleEvent(EventsHandler eventsHandler, boolean forRestartEvents) { eventsHandler.bluetoothPassed = (_connectionType == EventPreferencesBluetooth.CTYPE_NOT_CONNECTED); } } - PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "eventsHandler.bluetoothPassed="+eventsHandler.bluetoothPassed); +// PPApplicationStatic.logE("EventPreferencesBluetooth.doHandleEvent", "eventsHandler.bluetoothPassed="+eventsHandler.bluetoothPassed); } else { if ((_connectionType == EventPreferencesBluetooth.CTYPE_CONNECTED) || (_connectionType == EventPreferencesBluetooth.CTYPE_NOT_CONNECTED)) { diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java index 8293d11285..ca595fa1a6 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/PPApplication.java @@ -178,7 +178,7 @@ public class PPApplication extends Application @SuppressWarnings("PointlessBooleanExpression") static final boolean logIntoLogCat = true && DebugVersion.enabled; //TODO change it back to not log crash for releases - static final boolean logIntoFile = true; + static final boolean logIntoFile = false; @SuppressWarnings("PointlessBooleanExpression") static final boolean crashIntoFile = false && DebugVersion.enabled; static final boolean rootToolsDebug = false; @@ -233,7 +233,7 @@ public class PPApplication extends Application // +"|[WORKER_CALL]" // +"|[IN_EXECUTOR]" // +"|[EXECUTOR_CALL]" - +"|[IN_BROADCAST]" +// +"|[IN_BROADCAST]" // +"|[IN_BROADCAST_ALARM]" // +"|[LOCAL_BROADCAST_CALL]" // +"|[IN_OBSERVER]" @@ -273,7 +273,7 @@ public class PPApplication extends Application //+"|[RINGING_SIMULATION]" //+"|BluetoothConnectedDevicesDetector" //+"|BluetoothConnectionBroadcastReceiver" - +"|EventPreferencesBluetooth" + //+"|EventPreferencesBluetooth" //+"|CheckCriticalPPPReleasesBroadcastReceiver" ; From 4d64c57fa4ead364b4fc83c49d6723e2eef3fefe Mon Sep 17 00:00:00 2001 From: henrichg Date: Fri, 23 Feb 2024 09:45:29 +0100 Subject: [PATCH 17/19] Fix: Bad working BT connection broadcast receiver. (2) --- .../phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java | 1 - 1 file changed, 1 deletion(-) diff --git a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java index 492f6d3006..eee2ed1d6f 100644 --- a/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java +++ b/phoneProfilesPlus/src/main/java/sk/henrichg/phoneprofilesplus/BluetoothConnectionBroadcastReceiver.java @@ -142,7 +142,6 @@ public void onReceive(Context context, Intent intent) { }; PPApplicationStatic.createEventsHandlerExecutor(); PPApplication.eventsHandlerExecutor.submit(runnable); - //PPApplication.delayedEventsHandlerExecutor.schedule(runnable, 15, TimeUnit.SECONDS); } } From ff36725670e3a8b9983a706734decc5afdd7c8b8 Mon Sep 17 00:00:00 2001 From: henrichg Date: Fri, 23 Feb 2024 11:09:15 +0100 Subject: [PATCH 18/19] Updated translations. --- common/src/main/res/values-es/strings.xml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/common/src/main/res/values-es/strings.xml b/common/src/main/res/values-es/strings.xml index df0b908709..902eec81fe 100644 --- a/common/src/main/res/values-es/strings.xml +++ b/common/src/main/res/values-es/strings.xml @@ -1683,8 +1683,8 @@ Duración Tiempo exacto Después de la duración hacer - Cuando el tiempo exacto sea - Tiempo exacto + Cuando sea el momento exacto + Momento exacto Fin de la activación te d @@ -1928,7 +1928,7 @@ Instalar PPPPutSettings Instalar la última versión de PPPPutSettings haciendo clic en el botón Esto abre el navegador para descargar PPPPutSettings.apk en la carpeta \"Descargas\". - Luego instala este APK haciendo clic en la notificación sobre el APK descargado. + Luego, instala este APK haciendo clic en la notificación sobre el APK descargado. Nota: La versión Target de Android para PPPPutSettings es la 5.1. Por esta razón no es compatible con Google Play Protect. Pero PPPPutSettings es seguro, solo PhoneProfilesPlus puede usarlo. PPPPutSettings no está instalado! PPPPutSettings no instalado @@ -2015,9 +2015,9 @@ se está deteniendo… Nota: Si no es posible habilitar los ajustes de accesibilidad, ejecuta, por favor, PhoneProfilesPlusExtender y habilítalo desde allí. Cuando aparece el cuadro de diálogo \"Aplicación no segura\" de Google Play Protect durante la instalación, haz clic en la parte inferior, en el texto \"Más detalles\" y allí, también en la parte inferior, en el texto \"Instalar de todos modos\". - profile - error on set Wi-Fi - profile - error on set Wi-Fi hotspot - profile - error on close all applications + perfil - error al configurar la red inalámbrica (WiFi) + perfil - error al configurar el punto de acceso de la red inalámbrica (WiFi) + perfil - error al cerrar todas las aplicaciones Acceso directo al editor Haz clic aquí para crear un acceso directo al editor en el lanzador de inicio Editor @@ -2087,7 +2087,7 @@ El escaneo de células móviles no tiene intervalo de escaneo. Intervalo de escaneo de notificación El escaneo de notificaciones no tiene intervalo de escaneo. - What to do + ¿Qué hacer? Iniciar Activator Iniciar editor Reiniciar eventos From 6ee332e98c51bb1f448b6d80e75ab2783ee79fb7 Mon Sep 17 00:00:00 2001 From: henrichg Date: Fri, 23 Feb 2024 11:37:01 +0100 Subject: [PATCH 19/19] New version 6.4.1.1. --- README.md | 2 +- cospravit.txt | 1 + dependencies.gradle | 4 ++-- docs/FDroid_ChangeLog.html | 5 +++-- docs/FDroid_ChangeLog_CS.html | 5 +++-- docs/FDroid_ChangeLog_SK.html | 5 +++-- docs/releases-debug.md | 2 +- docs/releases.md | 2 +- fastlane/android/metadata/cs-CZ/changelogs/7120.txt | 9 +++++++++ fastlane/android/metadata/de/changelogs/7120.txt | 9 +++++++++ fastlane/android/metadata/en-US/changelogs/7120.txt | 9 +++++++++ fastlane/android/metadata/sk-SK/changelogs/7120.txt | 9 +++++++++ 12 files changed, 51 insertions(+), 11 deletions(-) create mode 100644 fastlane/android/metadata/cs-CZ/changelogs/7120.txt create mode 100644 fastlane/android/metadata/de/changelogs/7120.txt create mode 100644 fastlane/android/metadata/en-US/changelogs/7120.txt create mode 100644 fastlane/android/metadata/sk-SK/changelogs/7120.txt diff --git a/README.md b/README.md index 78c05c713b..2dfa020abb 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ PhoneProfilesPlus (aka PPP) =========================== -[![version](https://img.shields.io/badge/version-6.4.1-blue)](https://github.com/henrichg/PhoneProfilesPlus/releases/tag/6.4.1) +[![version](https://img.shields.io/badge/version-6.4.1.1-blue)](https://github.com/henrichg/PhoneProfilesPlus/releases/tag/6.4.1.1) [![Platform](https://img.shields.io/badge/platform-android-green.svg)](http://developer.android.com/index.html) [![License](https://img.shields.io/hexpm/l/plug.svg)](https://github.com/henrichg/PhoneProfilesPlus/blob/master/LICENSE) [![Crowdin](https://badges.crowdin.net/phoneprofilesplus/localized.svg)](https://crowdin.com/project/phoneprofilesplus) diff --git a/cospravit.txt b/cospravit.txt index 9edfb20f5e..7a32bccde9 100644 --- a/cospravit.txt +++ b/cospravit.txt @@ -493,6 +493,7 @@ https://developer.android.com/develop/connectivity/nfc/nfc#ext-type - Fix: Fixed not working immediate vibration notification for "Start of event", "End of event". - Fix: Fixed simulation of ringing. - Fix: Fixed leak in quick tiles. +- Fix: Fixed bad working Bluetooth sensor. - Fixed bugs. - Updated translations. diff --git a/dependencies.gradle b/dependencies.gradle index ec08787d48..dc1fc039eb 100644 --- a/dependencies.gradle +++ b/dependencies.gradle @@ -35,9 +35,9 @@ // 7090 = Removed support for Galaxy Store ext.ppVersions = [ - publishVersion : '6.4.1.1b', + publishVersion : '6.4.1.1', - publishVersionCode: 7114, + publishVersionCode: 7120, minSdk : 26, targetSdk : 28, diff --git a/docs/FDroid_ChangeLog.html b/docs/FDroid_ChangeLog.html index ef92198e87..0fbd28b9e3 100644 --- a/docs/FDroid_ChangeLog.html +++ b/docs/FDroid_ChangeLog.html @@ -7,7 +7,7 @@

PhoneProfilesPlus Changelog

-

Version: 6.4.1

+

Version: 6.4.1, 6.4.1.1

  • Change: Do not display contact phone number for "Notification sensor"/"Contacts" parameter.
  • @@ -32,6 +32,7 @@

    Version: 6.4.1

  • Fix: Fixed not working immediate vibration notification for "Start of event", "End of event".
  • Fix: Fixed simulation of ringing.
  • Fix: Fixed leak in quick tiles.
  • +
  • Fix: Fixed bad working Bluetooth sensor.
    @@ -43,7 +44,7 @@

    Version: 6.4.1

- Release information on GitHub. + Release information on GitHub.

diff --git a/docs/FDroid_ChangeLog_CS.html b/docs/FDroid_ChangeLog_CS.html index e93c932af7..91024c42e9 100644 --- a/docs/FDroid_ChangeLog_CS.html +++ b/docs/FDroid_ChangeLog_CS.html @@ -7,7 +7,7 @@

PhoneProfilesPlus Seznam změn

-

Verze: 6.4.1

+

Verze: 6.4.1, 6.4.1.1

  • Change: Do not display contact phone number for "Notification sensor"/"Contacts" parameter.
  • @@ -32,6 +32,7 @@

    Verze: 6.4.1

  • Fix: Fixed not working immediate vibration notification for "Start of event", "End of event".
  • Fix: Fixed simulation of ringing.
  • Fix: Fixed leak in quick tiles.
  • +
  • Fix: Fixed bad working Bluetooth sensor.
    @@ -43,7 +44,7 @@

    Verze: 6.4.1

- Informace o vydání na GitHub. + Informace o vydání na GitHub.

diff --git a/docs/FDroid_ChangeLog_SK.html b/docs/FDroid_ChangeLog_SK.html index 0eacab1d1d..b017a6b827 100644 --- a/docs/FDroid_ChangeLog_SK.html +++ b/docs/FDroid_ChangeLog_SK.html @@ -7,7 +7,7 @@

PhoneProfilesPlus Zoznam zmien

-

Verzia: 6.4.1

+

Verzia: 6.4.1, 6.4.1.1

  • Change: Do not display contact phone number for "Notification sensor"/"Contacts" parameter.
  • @@ -32,6 +32,7 @@

    Verzia: 6.4.1

  • Fix: Fixed not working immediate vibration notification for "Start of event", "End of event".
  • Fix: Fixed simulation of ringing.
  • Fix: Fixed leak in quick tiles.
  • +
  • Fix: Fixed bad working Bluetooth sensor.
    @@ -43,7 +44,7 @@

    Verzia: 6.4.1

- Informácie o vydaní na GitHub. + Informácie o vydaní na GitHub.

diff --git a/docs/releases-debug.md b/docs/releases-debug.md index 16780ede90..90b129f2c3 100644 --- a/docs/releases-debug.md +++ b/docs/releases-debug.md @@ -1 +1 @@ -@@@ppp-release:6.4.1:7110:normal***@@@ \ No newline at end of file +@@@ppp-release:6.4.1.1:7120:normal***@@@ \ No newline at end of file diff --git a/docs/releases.md b/docs/releases.md index 16780ede90..90b129f2c3 100644 --- a/docs/releases.md +++ b/docs/releases.md @@ -1 +1 @@ -@@@ppp-release:6.4.1:7110:normal***@@@ \ No newline at end of file +@@@ppp-release:6.4.1.1:7120:normal***@@@ \ No newline at end of file diff --git a/fastlane/android/metadata/cs-CZ/changelogs/7120.txt b/fastlane/android/metadata/cs-CZ/changelogs/7120.txt new file mode 100644 index 0000000000..88c81501fc --- /dev/null +++ b/fastlane/android/metadata/cs-CZ/changelogs/7120.txt @@ -0,0 +1,9 @@ +6.4.1, 6.4.1.1 +Change log: +- GUI and background additions. +- GUI and background changes. +- GUI and background fixes. +- Fixed application crashes. +- Updated translations. + +Full change log is in GitHub releases. (https://henrichg.github.io/PhoneProfilesPlus/FDroid_ChangeLog) diff --git a/fastlane/android/metadata/de/changelogs/7120.txt b/fastlane/android/metadata/de/changelogs/7120.txt new file mode 100644 index 0000000000..88c81501fc --- /dev/null +++ b/fastlane/android/metadata/de/changelogs/7120.txt @@ -0,0 +1,9 @@ +6.4.1, 6.4.1.1 +Change log: +- GUI and background additions. +- GUI and background changes. +- GUI and background fixes. +- Fixed application crashes. +- Updated translations. + +Full change log is in GitHub releases. (https://henrichg.github.io/PhoneProfilesPlus/FDroid_ChangeLog) diff --git a/fastlane/android/metadata/en-US/changelogs/7120.txt b/fastlane/android/metadata/en-US/changelogs/7120.txt new file mode 100644 index 0000000000..88c81501fc --- /dev/null +++ b/fastlane/android/metadata/en-US/changelogs/7120.txt @@ -0,0 +1,9 @@ +6.4.1, 6.4.1.1 +Change log: +- GUI and background additions. +- GUI and background changes. +- GUI and background fixes. +- Fixed application crashes. +- Updated translations. + +Full change log is in GitHub releases. (https://henrichg.github.io/PhoneProfilesPlus/FDroid_ChangeLog) diff --git a/fastlane/android/metadata/sk-SK/changelogs/7120.txt b/fastlane/android/metadata/sk-SK/changelogs/7120.txt new file mode 100644 index 0000000000..0bef446a87 --- /dev/null +++ b/fastlane/android/metadata/sk-SK/changelogs/7120.txt @@ -0,0 +1,9 @@ +6.4.1, 6.4.1.1 +Zoznam zmien: +- Novinky v GUI a procesoch na pozadí. +- Zmeny v GUI a procesoch na pozadí. +- Opravy v GUI a procesov na pozadí. +- Opravy pádov aplikácie. +- Aktualizované preklady. + +Úplný zoznam zmien je v GitHub vydaniach. (https://henrichg.github.io/PhoneProfilesPlus/FDroid_ChangeLog_SK)