summaryrefslogtreecommitdiffstats
path: root/services
diff options
context:
space:
mode:
authorSvet Ganov <svetoslavganov@google.com>2015-04-30 10:38:13 -0700
committerSvetoslav <svetoslavganov@google.com>2015-05-01 13:56:04 -0700
commitb9d71a6f89b1183f6389b1774652445a420c6cbf (patch)
treeb6f17102b2f86b40630e4a7cd681721797a8f324 /services
parent9fc943d1a69f2ab0f6d8285b09aef7e344a1fd1a (diff)
downloadframeworks_base-b9d71a6f89b1183f6389b1774652445a420c6cbf.zip
frameworks_base-b9d71a6f89b1183f6389b1774652445a420c6cbf.tar.gz
frameworks_base-b9d71a6f89b1183f6389b1774652445a420c6cbf.tar.bz2
Add body sensors app op - framework base
Change-Id: Idd5cd573fab3405e5b2a6e51d2d9d115650826e9
Diffstat (limited to 'services')
-rw-r--r--services/core/java/com/android/server/AppOpsService.java5
-rw-r--r--services/core/java/com/android/server/am/ActivityManagerService.java13
-rw-r--r--services/core/jni/com_android_server_SystemServer.cpp4
-rw-r--r--services/java/com/android/server/SystemServer.java9
4 files changed, 26 insertions, 5 deletions
diff --git a/services/core/java/com/android/server/AppOpsService.java b/services/core/java/com/android/server/AppOpsService.java
index 17b4939..1366149 100644
--- a/services/core/java/com/android/server/AppOpsService.java
+++ b/services/core/java/com/android/server/AppOpsService.java
@@ -744,6 +744,11 @@ public class AppOpsService extends IAppOpsService.Stub {
}
}
+ @Override
+ public int permissionToOpCode(String permission) {
+ return AppOpsManager.permissionToOpCode(permission);
+ }
+
void finishOperationLocked(Op op) {
if (op.nesting <= 1) {
if (op.nesting == 1) {
diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java
index 069878e..eea6234 100644
--- a/services/core/java/com/android/server/am/ActivityManagerService.java
+++ b/services/core/java/com/android/server/am/ActivityManagerService.java
@@ -47,6 +47,7 @@ import android.app.ProfilerInfo;
import android.app.usage.UsageEvents;
import android.app.usage.UsageStatsManagerInternal;
import android.appwidget.AppWidgetManager;
+import android.content.pm.PermissionInfo;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.Point;
@@ -6619,6 +6620,18 @@ public final class ActivityManagerService extends ActivityManagerNative
return mActivityManagerService.mContext.getPackageManager()
.getPackagesForUid(uid);
}
+
+ @Override
+ public boolean isRuntimePermission(String permission) {
+ try {
+ PermissionInfo info = mActivityManagerService.mContext.getPackageManager()
+ .getPermissionInfo(permission, 0);
+ return info.protectionLevel == PermissionInfo.PROTECTION_DANGEROUS;
+ } catch (NameNotFoundException nnfe) {
+ Slog.e(TAG, "No such permission: "+ permission, nnfe);
+ }
+ return false;
+ }
}
class IntentFirewallInterface implements IntentFirewall.AMSInterface {
diff --git a/services/core/jni/com_android_server_SystemServer.cpp b/services/core/jni/com_android_server_SystemServer.cpp
index c50d63c..64514a9 100644
--- a/services/core/jni/com_android_server_SystemServer.cpp
+++ b/services/core/jni/com_android_server_SystemServer.cpp
@@ -25,7 +25,7 @@
namespace android {
-static void android_server_SystemServer_nativeInit(JNIEnv* /* env */, jobject /* clazz */) {
+static void android_server_SystemServer_startSensorService(JNIEnv* /* env */, jobject /* clazz */) {
char propBuf[PROPERTY_VALUE_MAX];
property_get("system_init.startsensorservice", propBuf, "1");
if (strcmp(propBuf, "1") == 0) {
@@ -39,7 +39,7 @@ static void android_server_SystemServer_nativeInit(JNIEnv* /* env */, jobject /*
*/
static JNINativeMethod gMethods[] = {
/* name, signature, funcPtr */
- { "nativeInit", "()V", (void*) android_server_SystemServer_nativeInit },
+ { "startSensorService", "()V", (void*) android_server_SystemServer_startSensorService },
};
int register_android_server_SystemServer(JNIEnv* env)
diff --git a/services/java/com/android/server/SystemServer.java b/services/java/com/android/server/SystemServer.java
index 2922130..c1153b6 100644
--- a/services/java/com/android/server/SystemServer.java
+++ b/services/java/com/android/server/SystemServer.java
@@ -156,9 +156,9 @@ public final class SystemServer {
private boolean mFirstBoot;
/**
- * Called to initialize native system services.
+ * Start the sensor service.
*/
- private static native void nativeInit();
+ private static native void startSensorService();
/**
* The main entry point from zygote.
@@ -233,7 +233,6 @@ public final class SystemServer {
// Initialize native services.
System.loadLibrary("android_servers");
- nativeInit();
// Check whether we failed to shut down last time we tried.
// This call may not return.
@@ -359,6 +358,10 @@ public final class SystemServer {
// Set up the Application instance for the system process and get started.
mActivityManagerService.setSystemProcess();
+
+ // The sensor service needs access to package manager service, app ops
+ // service, and permissions service, therefore we start it after them.
+ startSensorService();
}
/**