diff options
| -rw-r--r-- | Android.bp | 18 | ||||
| -rw-r--r-- | core/res/res/values-mcc310-mnc410/config.xml | 3 | ||||
| -rw-r--r-- | core/res/res/values/config.xml | 4 | ||||
| -rw-r--r-- | core/res/res/values/symbols.xml | 1 | ||||
| -rw-r--r-- | libs/hwui/Properties.h | 2 | ||||
| -rw-r--r-- | native/android/Android.bp | 20 | ||||
| -rw-r--r-- | native/android/libandroid.map.txt | 194 | ||||
| -rw-r--r-- | native/graphics/jni/Android.bp | 20 | ||||
| -rw-r--r-- | native/graphics/jni/libjnigraphics.map.txt | 8 | ||||
| -rw-r--r-- | services/core/java/com/android/server/am/ActivityManagerService.java | 1 | ||||
| -rw-r--r-- | telephony/java/android/telephony/CarrierConfigManager.java | 10 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/nan/PublishConfig.java | 6 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/nan/SubscribeConfig.java | 2 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java | 9 | ||||
| -rw-r--r-- | wifi/java/android/net/wifi/nan/WifiNanManager.java | 31 |
15 files changed, 304 insertions, 25 deletions
diff --git a/Android.bp b/Android.bp new file mode 100644 index 000000000000..010b2b476e53 --- /dev/null +++ b/Android.bp @@ -0,0 +1,18 @@ +// Copyright (C) 2016 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +subdirs = [ + "native/android", + "native/graphics/jni", +] diff --git a/core/res/res/values-mcc310-mnc410/config.xml b/core/res/res/values-mcc310-mnc410/config.xml index cddd5e331b13..9accdf02537f 100644 --- a/core/res/res/values-mcc310-mnc410/config.xml +++ b/core/res/res/values-mcc310-mnc410/config.xml @@ -67,7 +67,4 @@ <item>"#8"</item> <item>"#9"</item> </string-array> - <!-- Flag indicating whether radio is to be restarted on the error of - PDP_FAIL_REGULAR_DEACTIVATION/0x24 --> - <bool name="config_restart_radio_on_pdp_fail_regular_deactivation">true</bool> </resources> diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 05d9a28333b7..44cbc0f91527 100644 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2220,10 +2220,6 @@ <string-array translatable="false" name="dial_string_replace"> </string-array> - <!-- Flag indicating whether radio is to be restarted on the error of - PDP_FAIL_REGULAR_DEACTIVATION/0x24 --> - <bool name="config_restart_radio_on_pdp_fail_regular_deactivation">false</bool> - <!-- networks that don't want data deactivate when shutdown the phone note this is dependent on the operator of the network we're on, not operator on the SIM --> diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 5018e2fb63c0..206a910e4b7c 100644 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2240,7 +2240,6 @@ <java-symbol type="attr" name="windowBackgroundFallback" /> <java-symbol type="id" name="textSpacerNoButtons" /> <java-symbol type="array" name="dial_string_replace" /> - <java-symbol type="bool" name="config_restart_radio_on_pdp_fail_regular_deactivation" /> <java-symbol type="array" name="networks_not_clear_data" /> <java-symbol type="bool" name="config_switch_phone_on_voice_reg_state_change" /> <java-symbol type="string" name="whichHomeApplicationNamed" /> diff --git a/libs/hwui/Properties.h b/libs/hwui/Properties.h index a1dadc83dfa9..881bd5f57714 100644 --- a/libs/hwui/Properties.h +++ b/libs/hwui/Properties.h @@ -149,7 +149,7 @@ enum DebugLevel { * This will disable the use of EGL_EXT_buffer_age and BUFFER_PRESERVED. * Default is "true" */ -#define PROPERTY_ENABLE_PARTIAL_UPDATES "debug.hwui.enable_partial_updates" +#define PROPERTY_ENABLE_PARTIAL_UPDATES "debug.hwui.use_partial_updates" #define PROPERTY_FILTER_TEST_OVERHEAD "debug.hwui.filter_test_overhead" diff --git a/native/android/Android.bp b/native/android/Android.bp new file mode 100644 index 000000000000..33c9655d647e --- /dev/null +++ b/native/android/Android.bp @@ -0,0 +1,20 @@ +// Copyright (C) 2016 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The headers module is in frameworks/native/Android.bp. +ndk_library { + name: "libandroid.ndk", + symbol_file: "libandroid.map.txt", + first_version: "9", +} diff --git a/native/android/libandroid.map.txt b/native/android/libandroid.map.txt new file mode 100644 index 000000000000..5758a3ce2a25 --- /dev/null +++ b/native/android/libandroid.map.txt @@ -0,0 +1,194 @@ +LIBANDROID { + global: + AAssetDir_close; + AAssetDir_getNextFileName; + AAssetDir_rewind; + AAssetManager_fromJava; + AAssetManager_open; + AAssetManager_openDir; + AAsset_close; + AAsset_getBuffer; + AAsset_getLength; + AAsset_getLength64; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AAsset_getRemainingLength; + AAsset_getRemainingLength64; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AAsset_isAllocated; + AAsset_openFileDescriptor; + AAsset_openFileDescriptor64; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AAsset_read; + AAsset_seek; + AAsset_seek64; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AChoreographer_getInstance; # introduced=24 + AChoreographer_postFrameCallback; # introduced=24 + AChoreographer_postFrameCallbackDelayed; # introduced=24 + AConfiguration_copy; + AConfiguration_delete; + AConfiguration_diff; + AConfiguration_fromAssetManager; + AConfiguration_getCountry; + AConfiguration_getDensity; + AConfiguration_getKeyboard; + AConfiguration_getKeysHidden; + AConfiguration_getLanguage; + AConfiguration_getLayoutDirection; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21 + AConfiguration_getMcc; + AConfiguration_getMnc; + AConfiguration_getNavHidden; + AConfiguration_getNavigation; + AConfiguration_getOrientation; + AConfiguration_getScreenHeightDp; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AConfiguration_getScreenLong; + AConfiguration_getScreenSize; + AConfiguration_getScreenWidthDp; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AConfiguration_getSdkVersion; + AConfiguration_getSmallestScreenWidthDp; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AConfiguration_getTouchscreen; + AConfiguration_getUiModeNight; + AConfiguration_getUiModeType; + AConfiguration_isBetterThan; + AConfiguration_match; + AConfiguration_new; + AConfiguration_setCountry; + AConfiguration_setDensity; + AConfiguration_setKeyboard; + AConfiguration_setKeysHidden; + AConfiguration_setLanguage; + AConfiguration_setLayoutDirection; # introduced-arm=17 introduced-arm64=21 introduced-mips=17 introduced-mips64=21 introduced-x86=17 introduced-x86_64=21 + AConfiguration_setMcc; + AConfiguration_setMnc; + AConfiguration_setNavHidden; + AConfiguration_setNavigation; + AConfiguration_setOrientation; + AConfiguration_setScreenHeightDp; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AConfiguration_setScreenLong; + AConfiguration_setScreenSize; + AConfiguration_setScreenWidthDp; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AConfiguration_setSdkVersion; + AConfiguration_setSmallestScreenWidthDp; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AConfiguration_setTouchscreen; + AConfiguration_setUiModeNight; + AConfiguration_setUiModeType; + AInputEvent_getDeviceId; + AInputEvent_getSource; + AInputEvent_getType; + AInputQueue_attachLooper; + AInputQueue_detachLooper; + AInputQueue_finishEvent; + AInputQueue_getEvent; + AInputQueue_hasEvents; + AInputQueue_preDispatchEvent; + AKeyEvent_getAction; + AKeyEvent_getDownTime; + AKeyEvent_getEventTime; + AKeyEvent_getFlags; + AKeyEvent_getKeyCode; + AKeyEvent_getMetaState; + AKeyEvent_getRepeatCount; + AKeyEvent_getScanCode; + ALooper_acquire; + ALooper_addFd; + ALooper_forThread; + ALooper_pollAll; + ALooper_pollOnce; + ALooper_prepare; + ALooper_release; + ALooper_removeFd; + ALooper_wake; + AMotionEvent_getAction; + AMotionEvent_getAxisValue; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AMotionEvent_getButtonState; # introduced-arm=14 introduced-arm64=21 introduced-mips=14 introduced-mips64=21 introduced-x86=14 introduced-x86_64=21 + AMotionEvent_getDownTime; + AMotionEvent_getEdgeFlags; + AMotionEvent_getEventTime; + AMotionEvent_getFlags; + AMotionEvent_getHistoricalAxisValue; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + AMotionEvent_getHistoricalEventTime; + AMotionEvent_getHistoricalOrientation; + AMotionEvent_getHistoricalPressure; + AMotionEvent_getHistoricalRawX; + AMotionEvent_getHistoricalRawY; + AMotionEvent_getHistoricalSize; + AMotionEvent_getHistoricalToolMajor; + AMotionEvent_getHistoricalToolMinor; + AMotionEvent_getHistoricalTouchMajor; + AMotionEvent_getHistoricalTouchMinor; + AMotionEvent_getHistoricalX; + AMotionEvent_getHistoricalY; + AMotionEvent_getHistorySize; + AMotionEvent_getMetaState; + AMotionEvent_getOrientation; + AMotionEvent_getPointerCount; + AMotionEvent_getPointerId; + AMotionEvent_getPressure; + AMotionEvent_getRawX; + AMotionEvent_getRawY; + AMotionEvent_getSize; + AMotionEvent_getToolMajor; + AMotionEvent_getToolMinor; + AMotionEvent_getToolType; # introduced-arm=14 introduced-arm64=21 introduced-mips=14 introduced-mips64=21 introduced-x86=14 introduced-x86_64=21 + AMotionEvent_getTouchMajor; + AMotionEvent_getTouchMinor; + AMotionEvent_getX; + AMotionEvent_getXOffset; + AMotionEvent_getXPrecision; + AMotionEvent_getY; + AMotionEvent_getYOffset; + AMotionEvent_getYPrecision; + ANativeActivity_finish; + ANativeActivity_hideSoftInput; + ANativeActivity_setWindowFlags; + ANativeActivity_setWindowFormat; + ANativeActivity_showSoftInput; + ANativeWindow_acquire; + ANativeWindow_fromSurface; + ANativeWindow_fromSurfaceTexture; # introduced-arm=13 introduced-mips=13 introduced-x86=13 + ANativeWindow_getFormat; + ANativeWindow_getHeight; + ANativeWindow_getWidth; + ANativeWindow_lock; + ANativeWindow_release; + ANativeWindow_setBuffersGeometry; + ANativeWindow_unlockAndPost; + AObbInfo_delete; + AObbInfo_getFlags; + AObbInfo_getPackageName; + AObbInfo_getVersion; + AObbScanner_getObbInfo; + ASensorEventQueue_disableSensor; + ASensorEventQueue_enableSensor; + ASensorEventQueue_getEvents; + ASensorEventQueue_hasEvents; + ASensorEventQueue_setEventRate; + ASensorManager_createEventQueue; + ASensorManager_destroyEventQueue; + ASensorManager_getDefaultSensor; + ASensorManager_getDefaultSensorEx; # introduced=21 + ASensorManager_getInstance; + ASensorManager_getSensorList; + ASensor_getFifoMaxEventCount; # introduced=21 + ASensor_getFifoReservedEventCount; # introduced=21 + ASensor_getMinDelay; + ASensor_getName; + ASensor_getReportingMode; # introduced=21 + ASensor_getResolution; + ASensor_getStringType; # introduced=21 + ASensor_getType; + ASensor_getVendor; + ASensor_isWakeUpSensor; # introduced=21 + AStorageManager_delete; + AStorageManager_getMountedObbPath; + AStorageManager_isObbMounted; + AStorageManager_mountObb; + AStorageManager_new; + AStorageManager_unmountObb; + ATrace_beginSection; # introduced=23 + ATrace_endSection; # introduced=23 + ATrace_isEnabled; # introduced=23 + android_getTtsEngine; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + android_getaddrinfofornetwork; # introduced=23 + android_setprocnetwork; # introduced=23 + android_setsocknetwork; # introduced=23 + getTtsEngine; # introduced-arm=13 introduced-arm64=21 introduced-mips=13 introduced-mips64=21 introduced-x86=13 introduced-x86_64=21 + local: + *; +}; diff --git a/native/graphics/jni/Android.bp b/native/graphics/jni/Android.bp new file mode 100644 index 000000000000..e09b0b4443cd --- /dev/null +++ b/native/graphics/jni/Android.bp @@ -0,0 +1,20 @@ +// Copyright (C) 2016 The Android Open Source Project +// +// Licensed under the Apache License, Version 2.0 (the "License"); +// you may not use this file except in compliance with the License. +// You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, software +// distributed under the License is distributed on an "AS IS" BASIS, +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +// See the License for the specific language governing permissions and +// limitations under the License. + +// The headers module is in frameworks/native/Android.bp. +ndk_library { + name: "libjnigraphics.ndk", + symbol_file: "libjnigraphics.map.txt", + first_version: "9", +} diff --git a/native/graphics/jni/libjnigraphics.map.txt b/native/graphics/jni/libjnigraphics.map.txt new file mode 100644 index 000000000000..a601d8af2830 --- /dev/null +++ b/native/graphics/jni/libjnigraphics.map.txt @@ -0,0 +1,8 @@ +LIBJNIGRAPHICS { + global: + AndroidBitmap_getInfo; + AndroidBitmap_lockPixels; + AndroidBitmap_unlockPixels; + local: + *; +}; diff --git a/services/core/java/com/android/server/am/ActivityManagerService.java b/services/core/java/com/android/server/am/ActivityManagerService.java index 0a7c26f81c86..74af37f971b7 100644 --- a/services/core/java/com/android/server/am/ActivityManagerService.java +++ b/services/core/java/com/android/server/am/ActivityManagerService.java @@ -11431,6 +11431,7 @@ public final class ActivityManagerService extends ActivityManagerNative && userId == UserHandle.USER_SYSTEM && (info.flags & PERSISTENT_MASK) == PERSISTENT_MASK) { r.persistent = true; + r.maxAdj = ProcessList.PERSISTENT_PROC_ADJ; } addProcessNameLocked(r); return r; diff --git a/telephony/java/android/telephony/CarrierConfigManager.java b/telephony/java/android/telephony/CarrierConfigManager.java index ff7ca6201b55..6eb792b7aba8 100644 --- a/telephony/java/android/telephony/CarrierConfigManager.java +++ b/telephony/java/android/telephony/CarrierConfigManager.java @@ -86,6 +86,15 @@ public class CarrierConfigManager { KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL = "require_entitlement_checks_bool"; /** + * Flag indicating whether radio is to be restarted on error PDP_FAIL_REGULAR_DEACTIVATION + * This is false by default. + * @hide + */ + public static final String + KEY_RESTART_RADIO_ON_PDP_FAIL_REGULAR_DEACTIVATION_BOOL = + "restart_radio_on_pdp_fail_regular_deactivation_bool"; + + /** * If true, enable vibration (haptic feedback) for key presses in the EmergencyDialer activity. * The pattern is set on a per-platform basis using config_virtualKeyVibePattern. To be * consistent with the regular Dialer, this value should agree with the corresponding values @@ -768,6 +777,7 @@ public class CarrierConfigManager { sDefaults.putBoolean(KEY_VOICE_PRIVACY_DISABLE_UI_BOOL, false); sDefaults.putBoolean(KEY_WORLD_PHONE_BOOL, false); sDefaults.putBoolean(KEY_REQUIRE_ENTITLEMENT_CHECKS_BOOL, true); + sDefaults.putBoolean(KEY_RESTART_RADIO_ON_PDP_FAIL_REGULAR_DEACTIVATION_BOOL, false); sDefaults.putInt(KEY_VOLTE_REPLACEMENT_RAT_INT, 0); sDefaults.putString(KEY_DEFAULT_SIM_CALL_MANAGER_STRING, ""); sDefaults.putString(KEY_VVM_DESTINATION_NUMBER_STRING, ""); diff --git a/wifi/java/android/net/wifi/nan/PublishConfig.java b/wifi/java/android/net/wifi/nan/PublishConfig.java index 5ffd54697e71..91513713daa3 100644 --- a/wifi/java/android/net/wifi/nan/PublishConfig.java +++ b/wifi/java/android/net/wifi/nan/PublishConfig.java @@ -321,7 +321,7 @@ public final class PublishConfig implements Parcelable { * will be broadcast. When the count is reached an event will be * generated for {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)} * with {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE} [unless - * {@link #setEnableTerminateNotification(boolean)} disables the callback]. + * {@link #setTerminateNotificationEnabled(boolean)} disables the callback]. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is @@ -347,7 +347,7 @@ public final class PublishConfig implements Parcelable { * an event will be generated for * {@link WifiNanDiscoverySessionCallback#onSessionTerminated(int)} with * {@link WifiNanDiscoverySessionCallback#TERMINATE_REASON_DONE} [unless - * {@link #setEnableTerminateNotification(boolean)} disables the callback]. + * {@link #setTerminateNotificationEnabled(boolean)} disables the callback]. * <p> * Optional. 0 by default - indicating the session doesn't terminate on its own. * Session will be terminated when {@link WifiNanDiscoveryBaseSession#destroy()} is @@ -377,7 +377,7 @@ public final class PublishConfig implements Parcelable { * @return The builder to facilitate chaining * {@code builder.setXXX(..).setXXX(..)}. */ - public Builder setEnableTerminateNotification(boolean enable) { + public Builder setTerminateNotificationEnabled(boolean enable) { mEnableTerminateNotification = enable; return this; } diff --git a/wifi/java/android/net/wifi/nan/SubscribeConfig.java b/wifi/java/android/net/wifi/nan/SubscribeConfig.java index 28d5d914886f..b1dcd8fe49d0 100644 --- a/wifi/java/android/net/wifi/nan/SubscribeConfig.java +++ b/wifi/java/android/net/wifi/nan/SubscribeConfig.java @@ -429,7 +429,7 @@ public final class SubscribeConfig implements Parcelable { * @return The builder to facilitate chaining * {@code builder.setXXX(..).setXXX(..)}. */ - public Builder setEnableTerminateNotification(boolean enable) { + public Builder setTerminateNotificationEnabled(boolean enable) { mEnableTerminateNotification = enable; return this; } diff --git a/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java b/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java index 5b84eb27dc84..17e974b14657 100644 --- a/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java +++ b/wifi/java/android/net/wifi/nan/WifiNanDiscoveryBaseSession.java @@ -16,6 +16,7 @@ package android.net.wifi.nan; +import android.annotation.NonNull; import android.annotation.Nullable; import android.annotation.SystemApi; import android.net.wifi.RttManager; @@ -163,7 +164,7 @@ public class WifiNanDiscoveryBaseSession { * (note: no retransmissions are attempted in other failure cases). A value of 0 * indicates no retries. Max permitted value is {@link #getMaxSendRetryCount()}. */ - public void sendMessage(Object peerHandle, int messageId, @Nullable byte[] message, + public void sendMessage(@NonNull Object peerHandle, int messageId, @Nullable byte[] message, int retryCount) { if (mTerminated) { Log.w(TAG, "sendMessage: called on terminated session"); @@ -205,7 +206,7 @@ public class WifiNanDiscoveryBaseSession { * can be arbitrary and non-unique. * @param message The message to be transmitted. */ - public void sendMessage(Object peerHandle, int messageId, @Nullable byte[] message) { + public void sendMessage(@NonNull Object peerHandle, int messageId, @Nullable byte[] message) { sendMessage(peerHandle, messageId, message, 0); } @@ -270,8 +271,8 @@ public class WifiNanDiscoveryBaseSession { * {@link android.net.ConnectivityManager#requestNetwork(android.net.NetworkRequest,android.net.ConnectivityManager.NetworkCallback)} * [or other varieties of that API]. */ - public String createNetworkSpecifier(@WifiNanManager.DataPathRole int role, Object peerHandle, - @Nullable byte[] token) { + public String createNetworkSpecifier(@WifiNanManager.DataPathRole int role, + @Nullable Object peerHandle, @Nullable byte[] token) { if (mTerminated) { Log.w(TAG, "createNetworkSpecifier: called on terminated session"); return null; diff --git a/wifi/java/android/net/wifi/nan/WifiNanManager.java b/wifi/java/android/net/wifi/nan/WifiNanManager.java index 815defbbff85..705ba4a5a4bd 100644 --- a/wifi/java/android/net/wifi/nan/WifiNanManager.java +++ b/wifi/java/android/net/wifi/nan/WifiNanManager.java @@ -459,15 +459,20 @@ public class WifiNanManager { /** @hide */ public void sendMessage(int clientId, int sessionId, Object peerHandle, byte[] message, int messageId, int retryCount) { + if (peerHandle == null) { + throw new IllegalArgumentException( + "sendMessage: invalid peerHandle - must be non-null"); + } + if (VDBG) { Log.v(TAG, "sendMessage(): clientId=" + clientId + ", sessionId=" + sessionId - + ", peerHandle=" + peerHandle + ", messageId=" + messageId + ", retryCount=" - + retryCount); + + ", peerHandle=" + ((OpaquePeerHandle) peerHandle).peerId + ", messageId=" + + messageId + ", retryCount=" + retryCount); } try { - mService.sendMessage(clientId, sessionId, (Integer) peerHandle, message, messageId, - retryCount); + mService.sendMessage(clientId, sessionId, ((OpaquePeerHandle) peerHandle).peerId, + message, messageId, retryCount); } catch (RemoteException e) { throw e.rethrowFromSystemServer(); } @@ -499,7 +504,8 @@ public class WifiNanManager { byte[] token) { if (VDBG) { Log.v(TAG, "createNetworkSpecifier: role=" + role + ", sessionId=" + sessionId - + ", peerHandle=" + peerHandle + ", token=" + token); + + ", peerHandle=" + ((peerHandle == null) ? peerHandle + : ((OpaquePeerHandle) peerHandle).peerId) + ", token=" + token); } int type; @@ -539,7 +545,7 @@ public class WifiNanManager { json.put(NETWORK_SPECIFIER_KEY_CLIENT_ID, clientId); json.put(NETWORK_SPECIFIER_KEY_SESSION_ID, sessionId); if (peerHandle != null) { - json.put(NETWORK_SPECIFIER_KEY_PEER_ID, (Integer) peerHandle); + json.put(NETWORK_SPECIFIER_KEY_PEER_ID, ((OpaquePeerHandle) peerHandle).peerId); } if (token != null) { json.put(NETWORK_SPECIFIER_KEY_TOKEN, @@ -844,7 +850,7 @@ public class WifiNanManager { break; case CALLBACK_MATCH: mOriginalCallback.onServiceDiscovered( - Integer.valueOf(msg.arg1), + new OpaquePeerHandle(msg.arg1), msg.getData().getByteArray(MESSAGE_BUNDLE_KEY_MESSAGE), msg.getData().getByteArray(MESSAGE_BUNDLE_KEY_MESSAGE2)); break; @@ -855,7 +861,7 @@ public class WifiNanManager { mOriginalCallback.onMessageSendFailed(msg.arg1); break; case CALLBACK_MESSAGE_RECEIVED: - mOriginalCallback.onMessageReceived(Integer.valueOf(msg.arg1), + mOriginalCallback.onMessageReceived(new OpaquePeerHandle(msg.arg1), (byte[]) msg.obj); break; } @@ -986,4 +992,13 @@ public class WifiNanManager { mOriginalCallback.onSessionTerminated(reason); } } + + /** @hide */ + public static class OpaquePeerHandle { + public OpaquePeerHandle(int peerId) { + this.peerId = peerId; + } + + public int peerId; + } } |