mirror of
https://github.com/signalapp/Signal-Android.git
synced 2025-12-24 04:58:45 +00:00
Specify exported status and PendingIntent mutability.
Also reduce shake sampling frequency, add coarse location permission. Random things for targetSdk 32.
This commit is contained in:
committed by
Cody Henthorne
parent
2566d6f61f
commit
b9f4dc3fe9
@@ -13,18 +13,31 @@ import android.os.Build
|
||||
*/
|
||||
object PendingIntentFlags {
|
||||
|
||||
@JvmStatic
|
||||
fun updateCurrent(): Int {
|
||||
return mutable() or PendingIntent.FLAG_UPDATE_CURRENT
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun cancelCurrent(): Int {
|
||||
return mutable() or PendingIntent.FLAG_CANCEL_CURRENT
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun oneShot(): Int {
|
||||
return mutable() or PendingIntent.FLAG_ONE_SHOT
|
||||
}
|
||||
|
||||
/**
|
||||
* The backwards compatible "default" value for pending intent flags.
|
||||
*/
|
||||
@JvmStatic
|
||||
fun mutable(): Int {
|
||||
return if (Build.VERSION.SDK_INT >= 31) PendingIntent.FLAG_MUTABLE else 0
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun immutable(): Int {
|
||||
return if (Build.VERSION.SDK_INT >= 23) PendingIntent.FLAG_IMMUTABLE else 0
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,7 +50,7 @@ public class ShakeDetector implements SensorEventListener {
|
||||
|
||||
if (accelerometer != null) {
|
||||
this.sensorManager = sensorManager;
|
||||
sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_FASTEST);
|
||||
sensorManager.registerListener(this, accelerometer, SensorManager.SENSOR_DELAY_NORMAL);
|
||||
}
|
||||
|
||||
return accelerometer != null;
|
||||
|
||||
Reference in New Issue
Block a user