summaryrefslogtreecommitdiff
path: root/src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java')
-rw-r--r--src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java b/src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java
index 194620f..d92665a 100644
--- a/src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java
+++ b/src/main/com/android/timezone/data/TimeZoneRulesDataProvider.java
@@ -31,6 +31,7 @@ import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.os.ParcelFileDescriptor;
+import android.os.UserHandle;
import android.provider.TimeZoneRulesDataContract;
import android.provider.TimeZoneRulesDataContract.Operation;
import android.support.annotation.NonNull;
@@ -94,6 +95,14 @@ public final class TimeZoneRulesDataProvider extends ContentProvider {
public void attachInfo(Context context, ProviderInfo info) {
super.attachInfo(context, info);
+ // The time zone update process should run as the system user exclusively as it's a
+ // system feature, not user dependent.
+ UserHandle currentUserHandle = android.os.Process.myUserHandle();
+ if (!currentUserHandle.isSystem()) {
+ throw new SecurityException("ContentProvider is supposed to run as the system user,"
+ + " instead user=" + currentUserHandle);
+ }
+
// Sanity check our security
if (!TimeZoneRulesDataContract.AUTHORITY.equals(info.authority)) {
// The authority looked for by the time zone updater is fixed.