samsung: doze: specify a qualified user to send the pulse broadcast
authorSean hoyt <seanhoyt963@gmail.com>
Tue, 17 Jan 2017 07:13:21 +0000 (07:13 +0000)
committerJan Altensen <info@stricted.net>
Fri, 20 Mar 2020 13:56:40 +0000 (14:56 +0100)
Should fix this:

W/ContextImpl(3700): Calling a method in the system process without a qualified user:
android.app.ContextImpl.sendBroadcast:877
android.content.ContextWrapper.sendBroadcast:421
com.cyanogenmod.settings.device.SamsungDozeService.launchDozePulse:151
com.cyanogenmod.settings.device.SamsungDozeService.-wrap1:-1
com.cyanogenmod.settings.device.SamsungDozeService$SamsungProximitySensor.onSensorChanged:81

Change-Id: I680a57c9010d06719c3bd014001b00353f8e12fd

doze/src/com/cyanogenmod/settings/device/SamsungDozeService.java

index 149f84b158bf4fa9afec72966ea9cb38c9f363ab..b748a715b07f75d53ec7f22c3e5dfb69dcfd3b0c 100644 (file)
@@ -28,6 +28,7 @@ import android.hardware.SensorEventListener;
 import android.hardware.SensorManager;
 import android.os.IBinder;
 import android.os.PowerManager;
+import android.os.UserHandle;
 import android.preference.PreferenceManager;
 import android.provider.Settings;
 import android.util.Log;
@@ -144,7 +145,8 @@ public class SamsungDozeService extends Service {
     }
 
     private void launchDozePulse() {
-        mContext.sendBroadcast(new Intent(DOZE_INTENT));
+        mContext.sendBroadcastAsUser(new Intent(DOZE_INTENT),
+                new UserHandle(UserHandle.USER_CURRENT));
     }
 
     private boolean isInteractive() {