diff options
11 files changed, 131 insertions, 182 deletions
diff --git a/core/java/android/bluetooth/BluetoothGatt.java b/core/java/android/bluetooth/BluetoothGatt.java index ef056654d7ef..68442ea40701 100644 --- a/core/java/android/bluetooth/BluetoothGatt.java +++ b/core/java/android/bluetooth/BluetoothGatt.java @@ -246,11 +246,12 @@ public final class BluetoothGatt implements BluetoothProfile { * Updates the internal value. * @hide */ - public void onCharacteristicRead(String address, int status, int srvcType, - int srvcInstId, ParcelUuid srvcUuid, - int charInstId, ParcelUuid charUuid, byte[] value) { + public void onCharacteristicRead(String address, int status, int handle, byte[] value) { if (VDBG) Log.d(TAG, "onCharacteristicRead() - Device=" + address - + " UUID=" + charUuid + " Status=" + status); + + " handle=" + handle + " Status=" + status); + + Log.w(TAG, "onCharacteristicRead() - Device=" + address + + " handle=" + handle + " Status=" + status); if (!address.equals(mDevice.getAddress())) { return; @@ -265,9 +266,7 @@ public final class BluetoothGatt implements BluetoothProfile { && mAuthRetry == false) { try { mAuthRetry = true; - mService.readCharacteristic(mClientIf, address, - srvcType, srvcInstId, srvcUuid, - charInstId, charUuid, AUTHENTICATION_MITM); + mService.readCharacteristic(mClientIf, address, handle, AUTHENTICATION_MITM); return; } catch (RemoteException e) { Log.e(TAG,"",e); @@ -276,13 +275,11 @@ public final class BluetoothGatt implements BluetoothProfile { mAuthRetry = false; - BluetoothGattService service = getService(mDevice, srvcUuid.getUuid(), - srvcInstId, srvcType); - if (service == null) return; - - BluetoothGattCharacteristic characteristic = service.getCharacteristic( - charUuid.getUuid(), charInstId); - if (characteristic == null) return; + BluetoothGattCharacteristic characteristic = getCharacteristicById(mDevice, handle); + if (characteristic == null) { + Log.w(TAG, "onCharacteristicRead() failed to find characteristic!"); + return; + } if (status == 0) characteristic.setValue(value); @@ -298,11 +295,9 @@ public final class BluetoothGatt implements BluetoothProfile { * Let the app know how we did... * @hide */ - public void onCharacteristicWrite(String address, int status, int srvcType, - int srvcInstId, ParcelUuid srvcUuid, - int charInstId, ParcelUuid charUuid) { + public void onCharacteristicWrite(String address, int status, int handle) { if (VDBG) Log.d(TAG, "onCharacteristicWrite() - Device=" + address - + " UUID=" + charUuid + " Status=" + status); + + " handle=" + handle + " Status=" + status); if (!address.equals(mDevice.getAddress())) { return; @@ -312,12 +307,7 @@ public final class BluetoothGatt implements BluetoothProfile { mDeviceBusy = false; } - BluetoothGattService service = getService(mDevice, srvcUuid.getUuid(), - srvcInstId, srvcType); - if (service == null) return; - - BluetoothGattCharacteristic characteristic = service.getCharacteristic( - charUuid.getUuid(), charInstId); + BluetoothGattCharacteristic characteristic = getCharacteristicById(mDevice, handle); if (characteristic == null) return; if ((status == GATT_INSUFFICIENT_AUTHENTICATION @@ -325,8 +315,7 @@ public final class BluetoothGatt implements BluetoothProfile { && mAuthRetry == false) { try { mAuthRetry = true; - mService.writeCharacteristic(mClientIf, address, - srvcType, srvcInstId, srvcUuid, charInstId, charUuid, + mService.writeCharacteristic(mClientIf, address, handle, characteristic.getWriteType(), AUTHENTICATION_MITM, characteristic.getValue()); return; @@ -349,21 +338,14 @@ public final class BluetoothGatt implements BluetoothProfile { * Updates the internal value. * @hide */ - public void onNotify(String address, int srvcType, - int srvcInstId, ParcelUuid srvcUuid, - int charInstId, ParcelUuid charUuid, - byte[] value) { - if (VDBG) Log.d(TAG, "onNotify() - Device=" + address + " UUID=" + charUuid); + public void onNotify(String address, int handle, byte[] value) { + if (VDBG) Log.d(TAG, "onNotify() - Device=" + address + " handle=" + handle); if (!address.equals(mDevice.getAddress())) { return; } - BluetoothGattService service = getService(mDevice, srvcUuid.getUuid(), - srvcInstId, srvcType); - if (service == null) return; - BluetoothGattCharacteristic characteristic = service.getCharacteristic( - charUuid.getUuid(), charInstId); + BluetoothGattCharacteristic characteristic = getCharacteristicById(mDevice, handle); if (characteristic == null) return; characteristic.setValue(value); @@ -379,12 +361,8 @@ public final class BluetoothGatt implements BluetoothProfile { * Descriptor has been read. * @hide */ - public void onDescriptorRead(String address, int status, int srvcType, - int srvcInstId, ParcelUuid srvcUuid, - int charInstId, ParcelUuid charUuid, - int descrInstId, ParcelUuid descrUuid, - byte[] value) { - if (VDBG) Log.d(TAG, "onDescriptorRead() - Device=" + address + " UUID=" + charUuid); + public void onDescriptorRead(String address, int status, int handle, byte[] value) { + if (VDBG) Log.d(TAG, "onDescriptorRead() - Device=" + address + " handle=" + handle); if (!address.equals(mDevice.getAddress())) { return; @@ -394,16 +372,7 @@ public final class BluetoothGatt implements BluetoothProfile { mDeviceBusy = false; } - BluetoothGattService service = getService(mDevice, srvcUuid.getUuid(), - srvcInstId, srvcType); - if (service == null) return; - - BluetoothGattCharacteristic characteristic = service.getCharacteristic( - charUuid.getUuid(), charInstId); - if (characteristic == null) return; - - BluetoothGattDescriptor descriptor = characteristic.getDescriptor( - descrUuid.getUuid(), descrInstId); + BluetoothGattDescriptor descriptor = getDescriptorById(mDevice, handle); if (descriptor == null) return; if (status == 0) descriptor.setValue(value); @@ -413,9 +382,7 @@ public final class BluetoothGatt implements BluetoothProfile { && mAuthRetry == false) { try { mAuthRetry = true; - mService.readDescriptor(mClientIf, address, - srvcType, srvcInstId, srvcUuid, charInstId, charUuid, - descrInstId, descrUuid, AUTHENTICATION_MITM); + mService.readDescriptor(mClientIf, address, handle, AUTHENTICATION_MITM); return; } catch (RemoteException e) { Log.e(TAG,"",e); @@ -435,11 +402,8 @@ public final class BluetoothGatt implements BluetoothProfile { * Descriptor write operation complete. * @hide */ - public void onDescriptorWrite(String address, int status, int srvcType, - int srvcInstId, ParcelUuid srvcUuid, - int charInstId, ParcelUuid charUuid, - int descrInstId, ParcelUuid descrUuid) { - if (VDBG) Log.d(TAG, "onDescriptorWrite() - Device=" + address + " UUID=" + charUuid); + public void onDescriptorWrite(String address, int status, int handle) { + if (VDBG) Log.d(TAG, "onDescriptorWrite() - Device=" + address + " handle=" + handle); if (!address.equals(mDevice.getAddress())) { return; @@ -449,16 +413,7 @@ public final class BluetoothGatt implements BluetoothProfile { mDeviceBusy = false; } - BluetoothGattService service = getService(mDevice, srvcUuid.getUuid(), - srvcInstId, srvcType); - if (service == null) return; - - BluetoothGattCharacteristic characteristic = service.getCharacteristic( - charUuid.getUuid(), charInstId); - if (characteristic == null) return; - - BluetoothGattDescriptor descriptor = characteristic.getDescriptor( - descrUuid.getUuid(), descrInstId); + BluetoothGattDescriptor descriptor = getDescriptorById(mDevice, handle); if (descriptor == null) return; if ((status == GATT_INSUFFICIENT_AUTHENTICATION @@ -466,9 +421,8 @@ public final class BluetoothGatt implements BluetoothProfile { && mAuthRetry == false) { try { mAuthRetry = true; - mService.writeDescriptor(mClientIf, address, - srvcType, srvcInstId, srvcUuid, charInstId, charUuid, - descrInstId, descrUuid, characteristic.getWriteType(), + mService.writeDescriptor(mClientIf, address, handle, + descriptor.getCharacteristic().getWriteType(), AUTHENTICATION_MITM, descriptor.getValue()); return; } catch (RemoteException e) { @@ -585,6 +539,37 @@ public final class BluetoothGatt implements BluetoothProfile { /** + * Returns a characteristic with id equal to instanceId. + * @hide + */ + /*package*/ BluetoothGattCharacteristic getCharacteristicById(BluetoothDevice device, int instanceId) { + for(BluetoothGattService svc : mServices) { + for(BluetoothGattCharacteristic charac : svc.getCharacteristics()) { + Log.w(TAG, "getCharacteristicById() comparing " + charac.getInstanceId() + " and " + instanceId); + if (charac.getInstanceId() == instanceId) + return charac; + } + } + return null; + } + + /** + * Returns a descriptor with id equal to instanceId. + * @hide + */ + /*package*/ BluetoothGattDescriptor getDescriptorById(BluetoothDevice device, int instanceId) { + for(BluetoothGattService svc : mServices) { + for(BluetoothGattCharacteristic charac : svc.getCharacteristics()) { + for(BluetoothGattDescriptor desc : charac.getDescriptors()) { + if (desc.getInstanceId() == instanceId) + return desc; + } + } + } + return null; + } + + /** * Register an application callback to start using GATT. * * <p>This is an asynchronous call. The callback {@link BluetoothGattCallback#onAppRegistered} @@ -832,9 +817,7 @@ public final class BluetoothGatt implements BluetoothProfile { try { mService.readCharacteristic(mClientIf, device.getAddress(), - service.getType(), service.getInstanceId(), - new ParcelUuid(service.getUuid()), characteristic.getInstanceId(), - new ParcelUuid(characteristic.getUuid()), AUTHENTICATION_NONE); + characteristic.getInstanceId(), AUTHENTICATION_NONE); } catch (RemoteException e) { Log.e(TAG,"",e); mDeviceBusy = false; @@ -877,11 +860,8 @@ public final class BluetoothGatt implements BluetoothProfile { try { mService.writeCharacteristic(mClientIf, device.getAddress(), - service.getType(), service.getInstanceId(), - new ParcelUuid(service.getUuid()), characteristic.getInstanceId(), - new ParcelUuid(characteristic.getUuid()), - characteristic.getWriteType(), AUTHENTICATION_NONE, - characteristic.getValue()); + characteristic.getInstanceId(), characteristic.getWriteType(), + AUTHENTICATION_NONE, characteristic.getValue()); } catch (RemoteException e) { Log.e(TAG,"",e); mDeviceBusy = false; @@ -922,11 +902,8 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - mService.readDescriptor(mClientIf, device.getAddress(), service.getType(), - service.getInstanceId(), new ParcelUuid(service.getUuid()), - characteristic.getInstanceId(), new ParcelUuid(characteristic.getUuid()), - descriptor.getInstanceId(), new ParcelUuid(descriptor.getUuid()), - AUTHENTICATION_NONE); + mService.readDescriptor(mClientIf, device.getAddress(), + descriptor.getInstanceId(), AUTHENTICATION_NONE); } catch (RemoteException e) { Log.e(TAG,"",e); mDeviceBusy = false; @@ -966,12 +943,8 @@ public final class BluetoothGatt implements BluetoothProfile { } try { - mService.writeDescriptor(mClientIf, device.getAddress(), service.getType(), - service.getInstanceId(), new ParcelUuid(service.getUuid()), - characteristic.getInstanceId(), new ParcelUuid(characteristic.getUuid()), - descriptor.getInstanceId(), new ParcelUuid(descriptor.getUuid()), - characteristic.getWriteType(), AUTHENTICATION_NONE, - descriptor.getValue()); + mService.writeDescriptor(mClientIf, device.getAddress(), descriptor.getInstanceId(), + characteristic.getWriteType(), AUTHENTICATION_NONE, descriptor.getValue()); } catch (RemoteException e) { Log.e(TAG,"",e); mDeviceBusy = false; @@ -1102,10 +1075,7 @@ public final class BluetoothGatt implements BluetoothProfile { try { mService.registerForNotification(mClientIf, device.getAddress(), - service.getType(), service.getInstanceId(), - new ParcelUuid(service.getUuid()), characteristic.getInstanceId(), - new ParcelUuid(characteristic.getUuid()), - enable); + characteristic.getInstanceId(), enable); } catch (RemoteException e) { Log.e(TAG,"",e); return false; diff --git a/core/java/android/bluetooth/BluetoothGattCallbackWrapper.java b/core/java/android/bluetooth/BluetoothGattCallbackWrapper.java index 64ead54e3d5c..17e533a5b32f 100644 --- a/core/java/android/bluetooth/BluetoothGattCallbackWrapper.java +++ b/core/java/android/bluetooth/BluetoothGattCallbackWrapper.java @@ -54,14 +54,12 @@ public class BluetoothGattCallbackWrapper extends IBluetoothGattCallback.Stub { } @Override - public void onCharacteristicRead(String address, int status, int srvcType, int srvcInstId, - ParcelUuid srvcUuid, int charInstId, ParcelUuid charUuid, byte[] value) + public void onCharacteristicRead(String address, int status, int handle, byte[] value) throws RemoteException { } @Override - public void onCharacteristicWrite(String address, int status, int srvcType, int srvcInstId, - ParcelUuid srvcUuid, int charInstId, ParcelUuid charUuid) throws RemoteException { + public void onCharacteristicWrite(String address, int status, int handle) throws RemoteException { } @Override @@ -69,20 +67,15 @@ public class BluetoothGattCallbackWrapper extends IBluetoothGattCallback.Stub { } @Override - public void onDescriptorRead(String address, int status, int srvcType, int srvcInstId, - ParcelUuid srvcUuid, int charInstId, ParcelUuid charUuid, int descrInstId, - ParcelUuid descrUuid, byte[] value) throws RemoteException { + public void onDescriptorRead(String address, int status, int handle, byte[] value) throws RemoteException { } @Override - public void onDescriptorWrite(String address, int status, int srvcType, int srvcInstId, - ParcelUuid srvcUuid, int charInstId, ParcelUuid charUuid, int descrInstId, - ParcelUuid descrUuid) throws RemoteException { + public void onDescriptorWrite(String address, int status, int handle) throws RemoteException { } @Override - public void onNotify(String address, int srvcType, int srvcInstId, ParcelUuid srvcUuid, - int charInstId, ParcelUuid charUuid, byte[] value) throws RemoteException { + public void onNotify(String address, int handle, byte[] value) throws RemoteException { } @Override diff --git a/core/java/android/bluetooth/IBluetoothGatt.aidl b/core/java/android/bluetooth/IBluetoothGatt.aidl index 3660be7c8eb5..45b512298e6e 100644 --- a/core/java/android/bluetooth/IBluetoothGatt.aidl +++ b/core/java/android/bluetooth/IBluetoothGatt.aidl @@ -50,28 +50,13 @@ interface IBluetoothGatt { void clientDisconnect(in int clientIf, in String address); void refreshDevice(in int clientIf, in String address); void discoverServices(in int clientIf, in String address); - void readCharacteristic(in int clientIf, in String address, in int srvcType, - in int srvcInstanceId, in ParcelUuid srvcId, - in int charInstanceId, in ParcelUuid charId, - in int authReq); - void writeCharacteristic(in int clientIf, in String address, in int srvcType, - in int srvcInstanceId, in ParcelUuid srvcId, - in int charInstanceId, in ParcelUuid charId, + void readCharacteristic(in int clientIf, in String address, in int handle, in int authReq); + void writeCharacteristic(in int clientIf, in String address, in int handle, in int writeType, in int authReq, in byte[] value); - void readDescriptor(in int clientIf, in String address, in int srvcType, - in int srvcInstanceId, in ParcelUuid srvcId, - in int charInstanceId, in ParcelUuid charId, - in int descrInstanceId, in ParcelUuid descrUuid, - in int authReq); - void writeDescriptor(in int clientIf, in String address, in int srvcType, - in int srvcInstanceId, in ParcelUuid srvcId, - in int charInstanceId, in ParcelUuid charId, - in int descrInstanceId, in ParcelUuid descrId, + void readDescriptor(in int clientIf, in String address, in int handle, in int authReq); + void writeDescriptor(in int clientIf, in String address, in int handle, in int writeType, in int authReq, in byte[] value); - void registerForNotification(in int clientIf, in String address, in int srvcType, - in int srvcInstanceId, in ParcelUuid srvcId, - in int charInstanceId, in ParcelUuid charId, - in boolean enable); + void registerForNotification(in int clientIf, in String address, in int handle, in boolean enable); void beginReliableWrite(in int clientIf, in String address); void endReliableWrite(in int clientIf, in String address, in boolean execute); void readRemoteRssi(in int clientIf, in String address); diff --git a/core/java/android/bluetooth/IBluetoothGattCallback.aidl b/core/java/android/bluetooth/IBluetoothGattCallback.aidl index f17724456123..7163c370694c 100644 --- a/core/java/android/bluetooth/IBluetoothGattCallback.aidl +++ b/core/java/android/bluetooth/IBluetoothGattCallback.aidl @@ -31,27 +31,12 @@ oneway interface IBluetoothGattCallback { void onScanResult(in ScanResult scanResult); void onBatchScanResults(in List<ScanResult> batchResults); void onSearchComplete(in String address, in List<BluetoothGattService> services, in int status); - void onCharacteristicRead(in String address, in int status, in int srvcType, - in int srvcInstId, in ParcelUuid srvcUuid, - in int charInstId, in ParcelUuid charUuid, - in byte[] value); - void onCharacteristicWrite(in String address, in int status, in int srvcType, - in int srvcInstId, in ParcelUuid srvcUuid, - in int charInstId, in ParcelUuid charUuid); + void onCharacteristicRead(in String address, in int status, in int handle, in byte[] value); + void onCharacteristicWrite(in String address, in int status, in int handle); void onExecuteWrite(in String address, in int status); - void onDescriptorRead(in String address, in int status, in int srvcType, - in int srvcInstId, in ParcelUuid srvcUuid, - in int charInstId, in ParcelUuid charUuid, - in int descrInstId, in ParcelUuid descrUuid, - in byte[] value); - void onDescriptorWrite(in String address, in int status, in int srvcType, - in int srvcInstId, in ParcelUuid srvcUuid, - in int charInstId, in ParcelUuid charUuid, - in int descrInstId, in ParcelUuid descrUuid); - void onNotify(in String address, in int srvcType, - in int srvcInstId, in ParcelUuid srvcUuid, - in int charInstId, in ParcelUuid charUuid, - in byte[] value); + void onDescriptorRead(in String address, in int status, in int handle, in byte[] value); + void onDescriptorWrite(in String address, in int status, in int handle); + void onNotify(in String address, in int handle, in byte[] value); void onReadRemoteRssi(in String address, in int rssi, in int status); void onMultiAdvertiseCallback(in int status, boolean isStart, in AdvertiseSettings advertiseSettings); diff --git a/core/java/com/android/internal/os/Zygote.java b/core/java/com/android/internal/os/Zygote.java index 919254a36a76..66cc97598ae8 100644 --- a/core/java/com/android/internal/os/Zygote.java +++ b/core/java/com/android/internal/os/Zygote.java @@ -149,6 +149,12 @@ public final class Zygote { native private static int nativeForkSystemServer(int uid, int gid, int[] gids, int debugFlags, int[][] rlimits, long permittedCapabilities, long effectiveCapabilities); + /** + * Zygote unmount storage space on initializing. + * This method is called once. + */ + native protected static void nativeUnmountStorageOnInit(); + private static void callPostForkChildHooks(int debugFlags, boolean isSystemServer, String instructionSet) { VM_HOOKS.postForkChild(debugFlags, isSystemServer, instructionSet); diff --git a/core/java/com/android/internal/os/ZygoteInit.java b/core/java/com/android/internal/os/ZygoteInit.java index 6317c07b21b3..48a79bb58753 100644 --- a/core/java/com/android/internal/os/ZygoteInit.java +++ b/core/java/com/android/internal/os/ZygoteInit.java @@ -621,6 +621,9 @@ public class ZygoteInit { // Zygote. Trace.setTracingEnabled(false); + // Zygote process unmounts root storage spaces. + Zygote.nativeUnmountStorageOnInit(); + if (startSystemServer) { startSystemServer(abiList, socketName); } diff --git a/core/jni/com_android_internal_os_Zygote.cpp b/core/jni/com_android_internal_os_Zygote.cpp index 4194aa410792..ce568536960c 100644 --- a/core/jni/com_android_internal_os_Zygote.cpp +++ b/core/jni/com_android_internal_os_Zygote.cpp @@ -302,9 +302,6 @@ static bool MountEmulatedStorage(uid_t uid, jint mount_mode, return false; } - // Unmount storage provided by root namespace and mount requested view - UnmountTree("/storage"); - String8 storageSource; if (mount_mode == MOUNT_EXTERNAL_DEFAULT) { storageSource = "/mnt/runtime/default"; @@ -663,12 +660,24 @@ static jint com_android_internal_os_Zygote_nativeForkSystemServer( return pid; } +static void com_android_internal_os_Zygote_nativeUnmountStorageOnInit(JNIEnv* env, jclass) { + // Zygote process unmount root storage space initially before every child processes are forked. + // Every forked child processes (include SystemServer) only mount their own root storage space + // And no need unmount storage operation in MountEmulatedStorage method. + // Zygote process does not utilize root storage spaces and unshared its mount namespace from the ART. + + UnmountTree("/storage"); + return; +} + static const JNINativeMethod gMethods[] = { { "nativeForkAndSpecialize", "(II[II[[IILjava/lang/String;Ljava/lang/String;[ILjava/lang/String;Ljava/lang/String;)I", (void *) com_android_internal_os_Zygote_nativeForkAndSpecialize }, { "nativeForkSystemServer", "(II[II[[IJJ)I", - (void *) com_android_internal_os_Zygote_nativeForkSystemServer } + (void *) com_android_internal_os_Zygote_nativeForkSystemServer }, + { "nativeUnmountStorageOnInit", "()V", + (void *) com_android_internal_os_Zygote_nativeUnmountStorageOnInit } }; int register_com_android_internal_os_Zygote(JNIEnv* env) { diff --git a/rs/java/android/renderscript/RenderScript.java b/rs/java/android/renderscript/RenderScript.java index 425569cd8fa1..9beaba301072 100644 --- a/rs/java/android/renderscript/RenderScript.java +++ b/rs/java/android/renderscript/RenderScript.java @@ -1387,6 +1387,27 @@ public class RenderScript { } /** + * Name of the file that holds the object cache. + */ + private static String mCachePath; + + /** + * Gets the path to the code cache. + */ + static synchronized String getCachePath() { + if (mCachePath == null) { + final String CACHE_PATH = "com.android.renderscript.cache"; + if (RenderScriptCacheDir.mCacheDir == null) { + throw new RSRuntimeException("RenderScript code cache directory uninitialized."); + } + File f = new File(RenderScriptCacheDir.mCacheDir, CACHE_PATH); + mCachePath = f.getAbsolutePath(); + f.mkdirs(); + } + return mCachePath; + } + + /** * Create a RenderScript context. * * @param ctx The context. @@ -1415,11 +1436,7 @@ public class RenderScript { } // set up cache directory for entire context - final String CACHE_PATH = "com.android.renderscript.cache"; - File f = new File(RenderScriptCacheDir.mCacheDir, CACHE_PATH); - String mCachePath = f.getAbsolutePath(); - f.mkdirs(); - rs.nContextSetCacheDir(mCachePath); + rs.nContextSetCacheDir(RenderScript.getCachePath()); rs.mMessageThread = new MessageThread(rs); rs.mMessageThread.start(); diff --git a/rs/java/android/renderscript/ScriptC.java b/rs/java/android/renderscript/ScriptC.java index bf706c131e85..00ebe5756589 100644 --- a/rs/java/android/renderscript/ScriptC.java +++ b/rs/java/android/renderscript/ScriptC.java @@ -84,13 +84,6 @@ public class ScriptC extends Script { setID(id); } - /** - * Name of the file that holds the object cache. - */ - private static final String CACHE_PATH = "com.android.renderscript.cache"; - - static String mCachePath; - private static synchronized long internalCreate(RenderScript rs, Resources resources, int resourceID) { byte[] pgm; int pgmLength; @@ -122,26 +115,12 @@ public class ScriptC extends Script { String resName = resources.getResourceEntryName(resourceID); - // Create the RS cache path if we haven't done so already. - if (mCachePath == null) { - File f = new File(RenderScriptCacheDir.mCacheDir, CACHE_PATH); - mCachePath = f.getAbsolutePath(); - f.mkdirs(); - } // Log.v(TAG, "Create script for resource = " + resName); - return rs.nScriptCCreate(resName, mCachePath, pgm, pgmLength); + return rs.nScriptCCreate(resName, RenderScript.getCachePath(), pgm, pgmLength); } private static synchronized long internalStringCreate(RenderScript rs, String resName, byte[] bitcode) { - // Create the RS cache path if we haven't done so already. - if (mCachePath == null) { - File f = new File(RenderScriptCacheDir.mCacheDir, CACHE_PATH); - mCachePath = f.getAbsolutePath(); - f.mkdirs(); - } // Log.v(TAG, "Create script for resource = " + resName); - return rs.nScriptCCreate(resName, mCachePath, bitcode, bitcode.length); + return rs.nScriptCCreate(resName, RenderScript.getCachePath(), bitcode, bitcode.length); } - - } diff --git a/rs/java/android/renderscript/ScriptGroup.java b/rs/java/android/renderscript/ScriptGroup.java index 9bbacbc0d84c..9357c3bb0428 100644 --- a/rs/java/android/renderscript/ScriptGroup.java +++ b/rs/java/android/renderscript/ScriptGroup.java @@ -396,7 +396,7 @@ public final class ScriptGroup extends BaseObj { for (int i = 0; i < closureIDs.length; i++) { closureIDs[i] = closures.get(i).getID(rs); } - long id = rs.nScriptGroup2Create(name, ScriptC.mCachePath, closureIDs); + long id = rs.nScriptGroup2Create(name, RenderScript.getCachePath(), closureIDs); setID(id); } diff --git a/services/core/java/com/android/server/job/controllers/ConnectivityController.java b/services/core/java/com/android/server/job/controllers/ConnectivityController.java index daba0d9c36d3..2d5e11a6b632 100644 --- a/services/core/java/com/android/server/job/controllers/ConnectivityController.java +++ b/services/core/java/com/android/server/job/controllers/ConnectivityController.java @@ -27,6 +27,7 @@ import android.os.ServiceManager; import android.os.UserHandle; import android.util.Slog; +import com.android.internal.os.BackgroundThread; import com.android.server.ConnectivityService; import com.android.server.job.JobSchedulerService; import com.android.server.job.StateChangedListener; @@ -70,7 +71,8 @@ public class ConnectivityController extends StateController implements IntentFilter intentFilter = new IntentFilter(); intentFilter.addAction(ConnectivityManager.CONNECTIVITY_ACTION); mContext.registerReceiverAsUser( - mConnectivityChangedReceiver, UserHandle.ALL, intentFilter, null, null); + mConnectivityChangedReceiver, UserHandle.ALL, intentFilter, null, + BackgroundThread.getHandler()); ConnectivityService cs = (ConnectivityService)ServiceManager.getService(Context.CONNECTIVITY_SERVICE); if (cs != null) { |