diff options
| -rw-r--r-- | core/jni/Android.mk | 4 | ||||
| -rw-r--r-- | core/jni/com_android_internal_os_Zygote.cpp | 53 | ||||
| -rw-r--r-- | core/jni/fd_utils-inl.h | 1 | ||||
| -rw-r--r-- | packages/PrintRecommendationService/AndroidManifest.xml | 6 | ||||
| -rw-r--r-- | services/core/java/com/android/server/BluetoothManagerService.java | 28 |
5 files changed, 42 insertions, 50 deletions
diff --git a/core/jni/Android.mk b/core/jni/Android.mk index 5fcde8b5bc4e..70e90044f3c7 100644 --- a/core/jni/Android.mk +++ b/core/jni/Android.mk @@ -20,10 +20,6 @@ ifneq ($(ENABLE_CPUSETS),) LOCAL_CFLAGS += -DENABLE_CPUSETS endif -ifneq ($(ENABLE_SCHED_BOOST),) - LOCAL_CFLAGS += -DENABLE_SCHED_BOOST -endif - LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES LOCAL_CFLAGS += -DU_USING_ICU_NAMESPACE=0 diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index d0815490159b..fec8f4e39efb 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -37,6 +37,7 @@ #include <sys/prctl.h> #include <sys/resource.h> #include <sys/stat.h> +#include <sys/time.h> #include <sys/types.h> #include <sys/utsname.h> #include <sys/wait.h> @@ -153,6 +154,24 @@ static void SetSigChldHandler() { } } +// Resets nice priority for zygote process. Zygote priority can be set +// to high value during boot phase to speed it up. We want to ensure +// zygote is running at normal priority before childs are forked from it. +// +// This ends up being called repeatedly before each fork(), but there's +// no real harm in that. +static void ResetNicePriority(JNIEnv* env) { + errno = 0; + int prio = getpriority(PRIO_PROCESS, 0); + if (prio == -1 && errno != 0) { + ALOGW("getpriority failed: %s\n", strerror(errno)); + } + if (prio != 0 && setpriority(PRIO_PROCESS, 0, 0) != 0) { + ALOGE("setpriority(%d, 0, 0) failed: %s", PRIO_PROCESS, strerror(errno)); + RuntimeAbort(env, __LINE__, "setpriority failed"); + } +} + // Sets the SIGCHLD handler back to default behavior in zygote children. static void UnsetSigChldHandler() { struct sigaction sa; @@ -418,27 +437,6 @@ void SetThreadName(const char* thread_name) { } } -#ifdef ENABLE_SCHED_BOOST -static void SetForkLoad(bool boost) { - // set scheduler knob to boost forked processes - pid_t currentPid = getpid(); - // fits at most "/proc/XXXXXXX/sched_init_task_load\0" - char schedPath[35]; - snprintf(schedPath, sizeof(schedPath), "/proc/%u/sched_init_task_load", currentPid); - int schedBoostFile = open(schedPath, O_WRONLY); - if (schedBoostFile < 0) { - ALOGW("Unable to set zygote scheduler boost"); - return; - } - if (boost) { - write(schedBoostFile, "100\0", 4); - } else { - write(schedBoostFile, "0\0", 2); - } - close(schedBoostFile); -} -#endif - // The list of open zygote file descriptors. static FileDescriptorTable* gOpenFdTable = NULL; @@ -452,10 +450,6 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra jstring instructionSet, jstring dataDir) { SetSigChldHandler(); -#ifdef ENABLE_SCHED_BOOST - SetForkLoad(true); -#endif - // Close any logging related FDs before we start evaluating the list of // file descriptors. __android_log_close(); @@ -472,6 +466,8 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra RuntimeAbort(env, __LINE__, "Unable to restat file descriptor table."); } + ResetNicePriority(env); + pid_t pid = fork(); if (pid == 0) { @@ -614,12 +610,6 @@ static pid_t ForkAndSpecializeCommon(JNIEnv* env, uid_t uid, gid_t gid, jintArra } } else if (pid > 0) { // the parent process - -#ifdef ENABLE_SCHED_BOOST - // unset scheduler knob - SetForkLoad(false); -#endif - } return pid; } @@ -750,4 +740,3 @@ int register_com_android_internal_os_Zygote(JNIEnv* env) { return RegisterMethodsOrDie(env, "com/android/internal/os/Zygote", gMethods, NELEM(gMethods)); } } // namespace android - diff --git a/core/jni/fd_utils-inl.h b/core/jni/fd_utils-inl.h index af2706911949..b78b8ffa2d5d 100644 --- a/core/jni/fd_utils-inl.h +++ b/core/jni/fd_utils-inl.h @@ -51,6 +51,7 @@ static const char* kPathWhitelist[] = { "/dev/null", "/dev/socket/zygote", "/dev/socket/zygote_secondary", + "/dev/socket/webview_zygote", "/sys/kernel/debug/tracing/trace_marker", "/system/framework/framework-res.apk", "/dev/urandom", diff --git a/packages/PrintRecommendationService/AndroidManifest.xml b/packages/PrintRecommendationService/AndroidManifest.xml index c6736d7bac23..2e9342c9354a 100644 --- a/packages/PrintRecommendationService/AndroidManifest.xml +++ b/packages/PrintRecommendationService/AndroidManifest.xml @@ -18,11 +18,11 @@ --> <manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.android.printservice.recommendation" - android:versionCode="1" - android:versionName="1.0.0"> + android:versionCode="2" + android:versionName="1.1.0"> <uses-sdk android:minSdkVersion="24" - android:targetSdkVersion="24" /> + android:targetSdkVersion="25" /> <uses-permission android:name="android.permission.INTERNET" /> diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 417531217b74..1035ac8f7c7b 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -335,12 +335,15 @@ class BluetoothManagerService extends IBluetoothManager.Stub { /** * Save the Bluetooth on/off state - * */ private void persistBluetoothSetting(int value) { + if (DBG) Slog.d(TAG, "Persisting Bluetooth Setting: " + value); + // waive WRITE_SECURE_SETTINGS permission check + long callingIdentity = Binder.clearCallingIdentity(); Settings.Global.putInt(mContext.getContentResolver(), Settings.Global.BLUETOOTH_ON, value); + Binder.restoreCallingIdentity(callingIdentity); } /** @@ -605,20 +608,26 @@ class BluetoothManagerService extends IBluetoothManager.Stub { } /** - * Action taken when GattService is turned off + * Action taken when GattService is turned on */ private void onBluetoothGattServiceUp() { if (DBG) Slog.d(TAG,"BluetoothGatt Service is Up"); try { mBluetoothLock.readLock().lock(); - if (isBleAppPresent() == false && mBluetooth != null - && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { + if (mBluetooth == null) { + if (DBG) Slog.w(TAG, "onBluetoothServiceUp: mBluetooth is null!"); + return; + } + int st = mBluetooth.getState(); + if (st != BluetoothAdapter.STATE_BLE_ON) { + if (DBG) Slog.v(TAG, "onBluetoothServiceUp: state isn't BLE_ON: " + + BluetoothAdapter.nameForState(st)); + return; + } + if (isBluetoothPersistedStateOnBluetooth() || !isBleAppPresent()) { + // This triggers transition to STATE_ON mBluetooth.onLeServiceUp(); - - // waive WRITE_SECURE_SETTINGS permission check - long callingIdentity = Binder.clearCallingIdentity(); persistBluetoothSetting(BLUETOOTH_ON_BLUETOOTH); - Binder.restoreCallingIdentity(callingIdentity); } } catch (RemoteException e) { Slog.e(TAG,"Unable to call onServiceUp", e); @@ -758,10 +767,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { synchronized(mReceiver) { if (persist) { - // waive WRITE_SECURE_SETTINGS permission check - long callingIdentity = Binder.clearCallingIdentity(); persistBluetoothSetting(BLUETOOTH_OFF); - Binder.restoreCallingIdentity(callingIdentity); } mEnableExternal = false; sendDisableMsg(); |