Closed jmauffret closed 4 years ago
To avoid the error "Error: app is in background uid null", use the following command : adb shell am start-foreground-service --user 0 -a jp.co.cyberagent.stf.ACTION_START -n jp.co.cyberagent.stf/.Service So we have to replace "startservice" by "start-foreground-service".
In the source code:
String channelName = getString(R.string.service_title);
NotificationChannel channel = new NotificationChannel(NOTIFICATION_CHANNEL_ID, channelName, NotificationManager.IMPORTANCE_NONE);
channel.setLockscreenVisibility(Notification.VISIBILITY_PRIVATE);
NotificationManager manager = (NotificationManager)getSystemService(Context.NOTIFICATION_SERVICE); manager.createNotificationChannel(channel);
NotificationCompat.Builder notificationBuilder = new NotificationCompat.Builder(this, NOTIFICATION_CHANNEL_ID);
Notification notification = notificationBuilder.setOngoing(true)
.setSmallIcon(android.R.drawable.ic_menu_info_details)
.setContentTitle(getString(R.string.service_title))
.setContentText(getString(R.string.service_text))
.setPriority(NotificationManager.IMPORTANCE_HIGH)
.setCategory(Notification.CATEGORY_SERVICE)
.build();
startForeground(NOTIFICATION_ID, notification);
Thanks for having a look! Maybe you could create a pull request with your changes?
Yes I can do it. But there are other issues to resolve in the class GetPropertiesResponder concerning permissions:
2019-03-19 15:48:21.547 15334-15441/jp.co.cyberagent.stf W/System.err: java.lang.SecurityException: getDeviceId: The user 10168 does not meet the requirements to access device identifiers. 2019-03-19 15:48:21.547 15334-15441/jp.co.cyberagent.stf W/System.err: at android.os.Parcel.createException(Parcel.java:2059) 2019-03-19 15:48:21.548 15334-15441/jp.co.cyberagent.stf W/System.err: at android.os.Parcel.readException(Parcel.java:2027) 2019-03-19 15:48:21.548 15334-15441/jp.co.cyberagent.stf W/System.err: at android.os.Parcel.readException(Parcel.java:1977)
Then to avoid Security Permission I have hardcoded the following methods in class GetPropertiesResponder : getDeviceId, getSubscriberId, getLine1Number, getSimSerialNumber. I should investigate more to find a workaround. But it works now on my Pixel 3 XL (Q preview) : you need to be rooted to enforce SELinux security policy and also a patch on minicap.
Can you submit the latest code to github?
Any progress on supporting Android Q for stfservice.apk? Thank you!
PR adding Android 10 https://github.com/openstf/STFService.apk/pull/38 has been merged. Release is in progress.
STFService doesn't run under Android Q due to several permission problems