Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

/dev/alarm no longer works for setting the time #23

Open
aecolley opened this issue Sep 11, 2014 · 2 comments
Open

/dev/alarm no longer works for setting the time #23

aecolley opened this issue Sep 11, 2014 · 2 comments

Comments

@aecolley
Copy link

NTPSync silently fails to set the time on my SGH-T889 (a T-Mobile-dehanced Samsung Galaxy Note 2), creating log entries like this:

E/DatabaseUtils( 3612): Writing exception to parcel
E/DatabaseUtils( 3612): java.lang.SecurityException: Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
E/DatabaseUtils( 3612): at com.android.server.am.ActivityManagerService.handleIncomingUser(ActivityManagerService.java:13175)
E/DatabaseUtils( 3612): at android.app.ActivityManager.handleIncomingUser(ActivityManager.java:2044)
E/DatabaseUtils( 3612): at com.android.providers.settings.SettingsProvider.callFromPackage(SettingsProvider.java:615)
E/DatabaseUtils( 3612): at android.content.ContentProvider$Transport.call(ContentProvider.java:279)
E/DatabaseUtils( 3612): at android.content.ContentProviderNative.onTransact(ContentProviderNative.java:273)
E/DatabaseUtils( 3612): at android.os.Binder.execTransact(Binder.java:388)
E/DatabaseUtils( 3612): at dalvik.system.NativeStart.run(Native Method)
W/ActivityManager( 3612): Permission Denial: get/set setting for user asks to run as user -2 but is calling from user 0; this requires android.permission.INTERACT_ACROSS_USERS_FULL
[...]
D/SystemClock( 7840): Setting time of day to sec=1410443164
D/SystemClock( 7840): Trying to open a file
E/SystemClock( 7840): File Open Failed
W/SystemClock( 7840): Unable to open alarm driver: Permission denied

The SuperSU log clearly shows NTPSync successfully chmoding /dev/alarm to mode 666 and back. Oddly, there are no log entries with the tag NTPSync and I haven't been able to trigger the making of any Debug-level entries with /data/local.prop.

A StackExchange answer lays out the /dev/alarm technique, but goes on to claim that on newer Samsung firmwares, it doesn't work because of SELinux restrictions, and that use of date is needed.

So, how about some use of date if setCurrentTimeMillis fails? Or at least an error message.

@gsauthof
Copy link

It also doesn't work on recent Android devices, in general (e.g. Android 7, LineageOS). See also garlicman's comment.

Logcat output from a Nexus 5 device with current LineageOS:

10-31 11:11:44.285 23131 23195 E SystemClock: Unable to set RTC
10-31 11:11:44.285 23131 23195 E SystemClock: java.lang.SecurityException: setTime: Neither user 10134 nor current process has android.permission.SET_TIME.
10-31 11:11:44.285 23131 23195 E SystemClock: 	at android.os.Parcel.readException(Parcel.java:1684)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at android.os.Parcel.readException(Parcel.java:1637)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at android.app.IAlarmManager$Stub$Proxy.setTime(IAlarmManager.java:235)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at android.os.SystemClock.setCurrentTimeMillis(SystemClock.java:150)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at org.sufficientlysecure.rootcommands.Toolbox$2.whileHavingPermissions(Toolbox.java:708)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at org.sufficientlysecure.rootcommands.Toolbox.withPermission(Toolbox.java:654)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at org.sufficientlysecure.rootcommands.Toolbox.withWritePermissions(Toolbox.java:672)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at org.sufficientlysecure.rootcommands.Toolbox.adjustSystemClock(Toolbox.java:704)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at org.ntpsync.util.Utils.setTime(Utils.java:82)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at org.ntpsync.service.NtpSyncService.onHandleIntent(NtpSyncService.java:163)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at android.app.IntentService$ServiceHandler.handleMessage(IntentService.java:68)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at android.os.Handler.dispatchMessage(Handler.java:102)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at android.os.Looper.loop(Looper.java:154)
10-31 11:11:44.285 23131 23195 E SystemClock: 	at android.os.HandlerThread.run(HandlerThread.java:61)

@lemmy04
Copy link

lemmy04 commented Jul 23, 2020

so ... is there any solution to this?
I'm getting all sorts of problems with two factor authentification using time based keys with this...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants