From: Michael W Date: Tue, 29 Dec 2020 17:23:17 +0000 (+0100) Subject: MotoActions: Don't crash settings X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=9ccc54c3d21c79323665d6fbcd8b80a001e104d6;p=GitHub%2FLineageOS%2Fandroid_hardware_motorola.git MotoActions: Don't crash settings * Registering a non-existing sensor causes a RuntimeException which crashes the Settings app which in turn takes down the whole system * Change the RuntimeExceptions to normal error loggings Change-Id: I18a73adc311bec6b70440a3266c7e2af74baa55a --- diff --git a/MotoActions/src/org/lineageos/settings/device/SensorHelper.java b/MotoActions/src/org/lineageos/settings/device/SensorHelper.java index 6cb3647..5d08a93 100644 --- a/MotoActions/src/org/lineageos/settings/device/SensorHelper.java +++ b/MotoActions/src/org/lineageos/settings/device/SensorHelper.java @@ -1,6 +1,6 @@ /* * Copyright (c) 2015 The CyanogenMod Project - * Copyright (c) 2017 The LineageOS Project + * Copyright (c) 2017-2020 The LineageOS Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -101,8 +101,8 @@ public class SensorHelper { public void registerListener(Sensor sensor, SensorEventListener listener) { if (!mSensorManager.registerListener(listener, sensor, - SensorManager.SENSOR_DELAY_NORMAL, BATCH_LATENCY_IN_MS * 1000)) { - throw new RuntimeException("Failed to registerListener for sensor " + sensor); + SensorManager.SENSOR_DELAY_NORMAL, BATCH_LATENCY_IN_MS * 1000)) { + Log.e(TAG, "Failed to registerListener for sensor " + sensor); } } @@ -113,7 +113,7 @@ public class SensorHelper { /* TriggerSensor */ public void requestTriggerSensor(Sensor sensor, TriggerEventListener listener) { if (!mSensorManager.requestTriggerSensor(listener, sensor)) { - throw new RuntimeException("Failed to requestTriggerSensor for sensor " + sensor); + Log.e(TAG, "Failed to requestTriggerSensor for sensor " + sensor); } }