1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-24 02:46:50 +01:00

Fossil Hybrid HR: Block dangerous intents by default and move some settings to developer settings submenu

This commit is contained in:
Arjan Schrijver 2021-05-31 10:16:33 +02:00
parent df3ee872ae
commit ecb23f7a22
6 changed files with 45 additions and 21 deletions

View File

@ -612,11 +612,11 @@
android:parentActivityName=".devices.qhybrid.HRConfigActivity" />
<activity
android:name=".devices.qhybrid.CalibrationActivity"
android:label="@string/qhybrid_title_calibration"
android:label="@string/qhybrid_pref_title_calibration"
android:parentActivityName=".devices.qhybrid.HRConfigActivity" />
<activity
android:name=".devices.qhybrid.CommuteActionsActivity"
android:label="Actions"
android:label="@string/qhybrid_pref_title_actions"
android:parentActivityName=".devices.qhybrid.HRConfigActivity" />
<activity
android:name=".devices.um25.Activity.DataActivity"

View File

@ -41,6 +41,7 @@ public class DeviceSettingsPreferenceConst {
public static final String PREF_HYBRID_HR_FORCE_WHITE_COLOR = "force_white_color_scheme";
public static final String PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES = "widget_draw_circles";
public static final String PREF_HYBRID_HR_SAVE_RAW_ACTIVITY_FILES = "save_raw_activity_files";
public static final String PREF_HYBRID_HR_DANGEROUS_EXTERNAL_INTENTS = "dangerous_external_intents";
public static final String PREF_LIFTWRIST_NOSHED = "activate_display_on_lift_wrist_noshed";
public static final String PREF_DISCONNECTNOTIF_NOSHED = "disconnect_notification_noshed";

View File

@ -67,6 +67,7 @@ import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.Dev
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_DO_NOT_DISTURB_NOAUTO;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_FAKE_RING_DURATION;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_FIND_PHONE_ENABLED;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_DANGEROUS_EXTERNAL_INTENTS;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_FORCE_WHITE_COLOR;
import static nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst.PREF_HYBRID_HR_SAVE_RAW_ACTIVITY_FILES;
@ -408,6 +409,7 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat {
addPreferenceHandlerFor(PREF_HYBRID_HR_DRAW_WIDGET_CIRCLES);
addPreferenceHandlerFor(PREF_HYBRID_HR_FORCE_WHITE_COLOR);
addPreferenceHandlerFor(PREF_HYBRID_HR_SAVE_RAW_ACTIVITY_FILES);
addPreferenceHandlerFor(PREF_HYBRID_HR_DANGEROUS_EXTERNAL_INTENTS);
addPreferenceHandlerFor(PREF_SONYSWR12_STAMINA);
addPreferenceHandlerFor(PREF_SONYSWR12_LOW_VIBRATION);

View File

@ -367,7 +367,9 @@ public class QHybridSupport extends QHybridBaseSupport {
break;
}
case QHYBRID_COMMAND_UPLOAD_FILE:{
handleFileUploadIntent(intent);
if (GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()).getBoolean(DeviceSettingsPreferenceConst.PREF_HYBRID_HR_DANGEROUS_EXTERNAL_INTENTS, true)) {
handleFileUploadIntent(intent);
}
break;
}
}

View File

@ -1001,7 +1001,7 @@
<string name="prefs_button_long_press_action_selection_title">Long press button action</string>
<string name="error_no_location_access">Location access must be granted and enabled for scanning to work properly</string>
<string name="pref_qhybrid_title_widget_draw_circles">Draw widget circles</string>
<string name="pref_qhybrid_save_raw_activity_files">Save raw activity files</string>
<string name="qhybrid_pref_save_raw_activity_files">Save raw activity files</string>
<string name="hr_widget_last_notification">Last notification</string>
<string name="homepage_url" translatable="false">Homepage: <a href="https://gadgetbridge.org/">https://gadgetbridge.org/</a></string>
<string name="codeberg_url" translatable="false">Code: <a href="https://codeberg.org/Freeyourgadget/Gadgetbridge">https://codeberg.org/Freeyourgadget/Gadgetbridge</a></string>
@ -1170,12 +1170,12 @@
<string name="qhybrid_title_background_image">Background image</string>
<string name="qhybrid_title_file_management">File management</string>
<string name="qhybrid_title_apps_management">Apps management</string>
<string name="qhybrid_title_calibration">Calibration</string>
<string name="qhybrid_pref_title_calibration">Calibration</string>
<string name="fossil_hr_warning_firmware_too_new">Some functions are disabled because the firmware of the watch is too new</string>
<string name="pref_title_physical_buttons">Physical buttons</string>
<string name="pref_summary_physical_buttons">Configure the functionality of the physical buttons on the watch</string>
<string name="qhybrid_summary_file_management">Upload and download files</string>
<string name="qhybrid_summary_calibration">Calibrate the watch hands</string>
<string name="qhybrid_pref_summary_calibration">Calibrate the watch hands</string>
<string name="pref_summary_canned_messages_set">Send the messages configured below to your device</string>
<string name="pref_summary_canned_messages_dismisscall">Dismiss calls from the watch with an SMS message</string>
<string name="fossil_hr_commute_actions_explanation">The actions configured here will appear in the Commute app on your watch. Read the wiki for information on how to handle the intents produced by these actions.</string>
@ -1189,4 +1189,10 @@
<string name="qhybrid_calibration_10_steps">10 steps</string>
<string name="qhybrid_calibration_100_steps">100 steps</string>
<string name="qhybrid_watchface_configuration_old_firmware">Watchface configuration screen for watches with firmware version DN1.0.2.19r and lower</string>
<string name="qhybrid_pref_title_actions">Actions</string>
<string name="qhybrid_pref_summary_actions">Actions for the Commute app</string>
<string name="pref_title_developer_settings">Developer settings</string>
<string name="pref_summary_developer_settings">Settings and functionality used by developers</string>
<string name="qhybrid_pref_title_external_intents">Allow dangerous external intents</string>
<string name="qhybrid_pref_summary_external_intents">Enable to allow other Android apps to upload/overwrite files</string>
</resources>

View File

@ -73,8 +73,8 @@
</PreferenceScreen>
<Preference
android:title="Actions"
android:summary="Actions for the Commute app">
android:title="@string/qhybrid_pref_title_actions"
android:summary="@string/qhybrid_pref_summary_actions">
<intent
android:targetPackage="nodomain.freeyourgadget.gadgetbridge"
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.CommuteActionsActivity" />
@ -88,24 +88,37 @@
app:showSeekBarValue="true" />
<Preference
android:title="@string/qhybrid_title_calibration"
android:summary="@string/qhybrid_summary_calibration">
android:title="@string/qhybrid_pref_title_calibration"
android:summary="@string/qhybrid_pref_summary_calibration">
<intent
android:targetPackage="nodomain.freeyourgadget.gadgetbridge"
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.CalibrationActivity" />
</Preference>
<SwitchPreference
android:defaultValue="false"
android:key="save_raw_activity_files"
android:title="@string/pref_qhybrid_save_raw_activity_files" />
<PreferenceScreen
android:key="developer_settings"
android:title="@string/pref_title_developer_settings"
android:summary="@string/pref_summary_developer_settings">
<Preference
android:title="@string/qhybrid_title_file_management"
android:summary="@string/qhybrid_summary_file_management">
<intent
android:targetPackage="nodomain.freeyourgadget.gadgetbridge"
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.FileManagementActivity" />
</Preference>
<SwitchPreference
android:defaultValue="false"
android:key="save_raw_activity_files"
android:title="@string/qhybrid_pref_save_raw_activity_files" />
<SwitchPreference
android:defaultValue="false"
android:key="dangerous_external_intents"
android:title="@string/qhybrid_pref_title_external_intents"
android:summary="@string/qhybrid_pref_summary_external_intents" />
<Preference
android:title="@string/qhybrid_title_file_management"
android:summary="@string/qhybrid_summary_file_management">
<intent
android:targetPackage="nodomain.freeyourgadget.gadgetbridge"
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.FileManagementActivity" />
</Preference>
</PreferenceScreen>
</androidx.preference.PreferenceScreen>