From 5dc486c4b1dc0900fa545949b1f6427ed75b50c4 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Wed, 29 Apr 2015 11:14:18 -0700 Subject: [PATCH 01/29] [DO NOT MERGE] Temp workaround to track max beacons. Change-Id: Ia65a7a0ec98d0181cf62db343e00c4a0b01c32d8 --- core/java/android/bluetooth/le/ScanSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/bluetooth/le/ScanSettings.java b/core/java/android/bluetooth/le/ScanSettings.java index 31d7963cd01d5..abe3efd7741da 100644 --- a/core/java/android/bluetooth/le/ScanSettings.java +++ b/core/java/android/bluetooth/le/ScanSettings.java @@ -227,7 +227,7 @@ public final class ScanSettings implements Parcelable { private int mScanResultType = SCAN_RESULT_TYPE_FULL; private long mReportDelayMillis = 0; private int mMatchMode = MATCH_MODE_AGGRESSIVE; - private int mNumOfMatchesPerFilter = MATCH_NUM_ONE_ADVERTISEMENT; + private int mNumOfMatchesPerFilter = MATCH_NUM_MAX_ADVERTISEMENT; /** * Set scan mode for Bluetooth LE scan. * From 75dfd6b3bfe6cd0b5a38f4603776bbf7dd4e10ee Mon Sep 17 00:00:00 2001 From: Nitin Arora Date: Wed, 29 Apr 2015 12:35:03 -0700 Subject: [PATCH 02/29] DO NOT MERGE Bluetooth: Ensure Bluetooth interface handle is valid This change adds null checks to Bluetooth interface handle to prevent using null references when BluetoothService is not up. Also removed the callbacks for the intermediate state removed for now as they are not being used. Change-Id: I4c4a406c99a51e0759d9163f7d658d64dee11ad9 --- .../server/BluetoothManagerService.java | 29 ++++++++----------- 1 file changed, 12 insertions(+), 17 deletions(-) diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 46a4599dad362..5d353b6372fac 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -503,7 +503,8 @@ class BluetoothManagerService extends IBluetoothManager.Stub { private void onBluetoothGattServiceUp() { if (DBG) Log.d(TAG,"BluetoothGatt Service is Up"); try{ - if (isBleAppPresent() == false && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { + if (isBleAppPresent() == false && mBluetooth != null + && mBluetooth.getState() == BluetoothAdapter.STATE_BLE_ON) { mBluetooth.onLeServiceUp(); // waive WRITE_SECURE_SETTINGS permission check @@ -522,32 +523,26 @@ class BluetoothManagerService extends IBluetoothManager.Stub { */ private void sendBrEdrDownCallback() { if (DBG) Log.d(TAG,"Calling sendBrEdrDownCallback callbacks"); - int n = mCallbacks.beginBroadcast(); + + if(mBluetooth == null) { + Log.w(TAG, "Bluetooth handle is null"); + return; + } if (isBleAppPresent() == false) { try { mBluetooth.onBrEdrDown(); } catch(RemoteException e) { - Log.e(TAG,"Unable to call onBrEdrDown", e); + Log.e(TAG, "Call to onBrEdrDown() failed.", e); } - } - else{//need to stay at BLE ON. disconnect all Gatt connections + } else { + // Need to stay at BLE ON. Disconnect all Gatt connections try{ - mBluetoothGatt.unregAll();//disconnectAll(); + mBluetoothGatt.unregAll(); } catch(RemoteException e) { - Log.e(TAG,"Unable to disconn all", e); + Log.e(TAG, "Unable to disconnect all apps.", e); } } - - Log.d(TAG,"Broadcasting onBrEdrDown() to " + n + " receivers."); - for (int i=0; i Date: Thu, 23 Apr 2015 15:47:06 -0700 Subject: [PATCH 03/29] DO NOT MERGE Add handler parameter for callbacks. Bug: 20160491 Change-Id: I94639b06b8c97b6585e169d667a67ce328e716af --- api/current.txt | 6 +- api/system-current.txt | 6 +- telecomm/java/android/telecom/Call.java | 139 ++++++++-- .../java/android/telecom/CallbackRecord.java | 44 ++++ .../java/android/telecom/InCallService.java | 13 +- telecomm/java/android/telecom/Phone.java | 4 +- .../android/telecom/RemoteConference.java | 112 ++++++-- .../android/telecom/RemoteConnection.java | 244 ++++++++++++++---- .../java/android/telecom/VideoCallImpl.java | 67 +++-- 9 files changed, 510 insertions(+), 125 deletions(-) create mode 100644 telecomm/java/android/telecom/CallbackRecord.java diff --git a/api/current.txt b/api/current.txt index 34936d1df6e04..3d4b86eb9db6f 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28351,6 +28351,7 @@ package android.telecom { method public void playDtmfTone(char); method public void postDialContinue(boolean); method public void registerCallback(android.telecom.Call.Callback); + method public void registerCallback(android.telecom.Call.Callback, android.os.Handler); method public void reject(boolean, java.lang.String); method public void splitFromConference(); method public void stopDtmfTone(); @@ -28670,6 +28671,7 @@ package android.telecom { public static abstract class InCallService.VideoCall { ctor public InCallService.VideoCall(); method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback); + method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback, android.os.Handler); method public abstract void requestCallDataUsage(); method public abstract void requestCameraCapabilities(); method public abstract void sendSessionModifyRequest(android.telecom.VideoProfile); @@ -28680,7 +28682,7 @@ package android.telecom { method public abstract void setPauseImage(java.lang.String); method public abstract void setPreviewSurface(android.view.Surface); method public abstract void setZoom(float); - method public abstract void unregisterCallback(); + method public abstract void unregisterCallback(android.telecom.InCallService.VideoCall.Callback); } public static abstract class InCallService.VideoCall.Callback { @@ -28768,6 +28770,7 @@ package android.telecom { method public void merge(); method public void playDtmfTone(char); method public final void registerCallback(android.telecom.RemoteConference.Callback); + method public final void registerCallback(android.telecom.RemoteConference.Callback, android.os.Handler); method public void separate(android.telecom.RemoteConnection); method public void setAudioState(android.telecom.AudioState); method public void stopDtmfTone(); @@ -28807,6 +28810,7 @@ package android.telecom { method public void playDtmfTone(char); method public void postDialContinue(boolean); method public void registerCallback(android.telecom.RemoteConnection.Callback); + method public void registerCallback(android.telecom.RemoteConnection.Callback, android.os.Handler); method public void reject(); method public void setAudioState(android.telecom.AudioState); method public void stopDtmfTone(); diff --git a/api/system-current.txt b/api/system-current.txt index 0b71feb7625b8..d4e728caf5ea2 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30167,6 +30167,7 @@ package android.telecom { method public void playDtmfTone(char); method public void postDialContinue(boolean); method public void registerCallback(android.telecom.Call.Callback); + method public void registerCallback(android.telecom.Call.Callback, android.os.Handler); method public void reject(boolean, java.lang.String); method public deprecated void removeListener(android.telecom.Call.Listener); method public void splitFromConference(); @@ -30494,6 +30495,7 @@ package android.telecom { public static abstract class InCallService.VideoCall { ctor public InCallService.VideoCall(); method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback); + method public abstract void registerCallback(android.telecom.InCallService.VideoCall.Callback, android.os.Handler); method public abstract void requestCallDataUsage(); method public abstract void requestCameraCapabilities(); method public abstract void sendSessionModifyRequest(android.telecom.VideoProfile); @@ -30504,7 +30506,7 @@ package android.telecom { method public abstract void setPauseImage(java.lang.String); method public abstract void setPreviewSurface(android.view.Surface); method public abstract void setZoom(float); - method public abstract void unregisterCallback(); + method public abstract void unregisterCallback(android.telecom.InCallService.VideoCall.Callback); } public static abstract class InCallService.VideoCall.Callback { @@ -30612,6 +30614,7 @@ package android.telecom { method public void merge(); method public void playDtmfTone(char); method public final void registerCallback(android.telecom.RemoteConference.Callback); + method public final void registerCallback(android.telecom.RemoteConference.Callback, android.os.Handler); method public void separate(android.telecom.RemoteConnection); method public void setAudioState(android.telecom.AudioState); method public void stopDtmfTone(); @@ -30651,6 +30654,7 @@ package android.telecom { method public void playDtmfTone(char); method public void postDialContinue(boolean); method public void registerCallback(android.telecom.RemoteConnection.Callback); + method public void registerCallback(android.telecom.RemoteConnection.Callback, android.os.Handler); method public void reject(); method public void setAudioState(android.telecom.AudioState); method public void stopDtmfTone(); diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index a635e446b28f5..437dc44e1e62b 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -19,10 +19,12 @@ package android.telecom; import android.annotation.SystemApi; import android.net.Uri; import android.os.Bundle; +import android.os.Handler; import java.lang.String; import java.util.ArrayList; import java.util.Collections; +import java.util.LinkedList; import java.util.List; import java.util.Map; import java.util.Objects; @@ -645,7 +647,7 @@ public final class Call { private final List mChildrenIds = new ArrayList<>(); private final List mChildren = new ArrayList<>(); private final List mUnmodifiableChildren = Collections.unmodifiableList(mChildren); - private final List mCallbacks = new CopyOnWriteArrayList<>(); + private final List> mCallbackRecords = new CopyOnWriteArrayList<>(); private final List mConferenceableCalls = new ArrayList<>(); private final List mUnmodifiableConferenceableCalls = Collections.unmodifiableList(mConferenceableCalls); @@ -887,7 +889,20 @@ public final class Call { * @param callback A {@code Callback}. */ public void registerCallback(Callback callback) { - mCallbacks.add(callback); + registerCallback(callback, new Handler()); + } + + /** + * Registers a callback to this {@code Call}. + * + * @param callback A {@code Callback}. + * @param handler A handler which command and status changes will be delivered to. + */ + public void registerCallback(Callback callback, Handler handler) { + unregisterCallback(callback); + if (callback != null && handler != null) { + mCallbackRecords.add(new CallbackRecord(callback, handler)); + } } /** @@ -897,7 +912,12 @@ public final class Call { */ public void unregisterCallback(Callback callback) { if (callback != null) { - mCallbacks.remove(callback); + for (CallbackRecord record : mCallbackRecords) { + if (record.getCallback() == callback) { + mCallbackRecords.remove(record); + break; + } + } } } @@ -1058,57 +1078,120 @@ public final class Call { } } - private void fireStateChanged(int newState) { - for (Callback callback : mCallbacks) { - callback.onStateChanged(this, newState); + private void fireStateChanged(final int newState) { + for (CallbackRecord record : mCallbackRecords) { + final Call call = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onStateChanged(call, newState); + } + }); } } - private void fireParentChanged(Call newParent) { - for (Callback callback : mCallbacks) { - callback.onParentChanged(this, newParent); + private void fireParentChanged(final Call newParent) { + for (CallbackRecord record : mCallbackRecords) { + final Call call = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onParentChanged(call, newParent); + } + }); } } - private void fireChildrenChanged(List children) { - for (Callback callback : mCallbacks) { - callback.onChildrenChanged(this, children); + private void fireChildrenChanged(final List children) { + for (CallbackRecord record : mCallbackRecords) { + final Call call = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onChildrenChanged(call, children); + } + }); } } - private void fireDetailsChanged(Details details) { - for (Callback callback : mCallbacks) { - callback.onDetailsChanged(this, details); + private void fireDetailsChanged(final Details details) { + for (CallbackRecord record : mCallbackRecords) { + final Call call = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onDetailsChanged(call, details); + } + }); } } - private void fireCannedTextResponsesLoaded(List cannedTextResponses) { - for (Callback callback : mCallbacks) { - callback.onCannedTextResponsesLoaded(this, cannedTextResponses); + private void fireCannedTextResponsesLoaded(final List cannedTextResponses) { + for (CallbackRecord record : mCallbackRecords) { + final Call call = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onCannedTextResponsesLoaded(call, cannedTextResponses); + } + }); } } - private void fireVideoCallChanged(InCallService.VideoCall videoCall) { - for (Callback callback : mCallbacks) { - callback.onVideoCallChanged(this, videoCall); + private void fireVideoCallChanged(final InCallService.VideoCall videoCall) { + for (CallbackRecord record : mCallbackRecords) { + final Call call = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onVideoCallChanged(call, videoCall); + } + }); } } - private void firePostDialWait(String remainingPostDialSequence) { - for (Callback callback : mCallbacks) { - callback.onPostDialWait(this, remainingPostDialSequence); + private void firePostDialWait(final String remainingPostDialSequence) { + for (CallbackRecord record : mCallbackRecords) { + final Call call = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onPostDialWait(call, remainingPostDialSequence); + } + }); } } private void fireCallDestroyed() { - for (Callback callback : mCallbacks) { - callback.onCallDestroyed(this); + for (CallbackRecord record: mCallbackRecords) { + final Call call = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onCallDestroyed(call); + } + }); } } private void fireConferenceableCallsChanged() { - for (Callback callback : mCallbacks) { - callback.onConferenceableCallsChanged(this, mUnmodifiableConferenceableCalls); + for (CallbackRecord record : mCallbackRecords) { + final Call call = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConferenceableCallsChanged(call, mUnmodifiableConferenceableCalls); + } + }); } } diff --git a/telecomm/java/android/telecom/CallbackRecord.java b/telecomm/java/android/telecom/CallbackRecord.java new file mode 100644 index 0000000000000..1a81925dd248f --- /dev/null +++ b/telecomm/java/android/telecom/CallbackRecord.java @@ -0,0 +1,44 @@ +/* + * Copyright (C) 2015 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. + */ + +package android.telecom; + +import android.os.Handler; + + +/** + * This class is used to associate a generic callback of type T with a handler to which commands and + * status updates will be delivered to. + * + * @hide + */ +class CallbackRecord { + private final T mCallback; + private final Handler mHandler; + + public CallbackRecord(T callback, Handler handler) { + mCallback = callback; + mHandler = handler; + } + + public T getCallback() { + return mCallback; + } + + public Handler getHandler() { + return mHandler; + } +} diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java index 020a33f2b0db5..5392298b0b60e 100644 --- a/telecomm/java/android/telecom/InCallService.java +++ b/telecomm/java/android/telecom/InCallService.java @@ -362,6 +362,9 @@ public abstract class InCallService extends Service { */ public static abstract class VideoCall { + /** @hide */ + public abstract void destroy(); + /** * Registers a callback to receive commands and state changes for video calls. * @@ -369,10 +372,18 @@ public abstract class InCallService extends Service { */ public abstract void registerCallback(VideoCall.Callback callback); + /** + * Registers a callback to receive commands and state changes for video calls. + * + * @param callback The video call callback. + * @param handler A handler which commands and status changes will be delivered to. + */ + public abstract void registerCallback(VideoCall.Callback callback, Handler handler); + /** * Unregisters the callback set via {@link #registerCallback(Callback)}. */ - public abstract void unregisterCallback(); + public abstract void unregisterCallback(VideoCall.Callback callback); /** * Sets the camera to be used for video recording in a video call. diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java index 3d9acda688c85..4cdfd2eb8f561 100644 --- a/telecomm/java/android/telecom/Phone.java +++ b/telecomm/java/android/telecom/Phone.java @@ -125,7 +125,7 @@ public final class Phone { InCallService.VideoCall videoCall = call.getVideoCall(); if (videoCall != null) { - videoCall.unregisterCallback(); + videoCall.destroy(); } fireCallRemoved(call); } @@ -174,7 +174,7 @@ public final class Phone { for (Call call : mCalls) { InCallService.VideoCall videoCall = call.getVideoCall(); if (videoCall != null) { - videoCall.unregisterCallback(); + videoCall.destroy(); } if (call.getState() != Call.STATE_DISCONNECTED) { call.internalSetDisconnected(); diff --git a/telecomm/java/android/telecom/RemoteConference.java b/telecomm/java/android/telecom/RemoteConference.java index fba3ee3265f90..a76bf5998a514 100644 --- a/telecomm/java/android/telecom/RemoteConference.java +++ b/telecomm/java/android/telecom/RemoteConference.java @@ -18,6 +18,7 @@ package android.telecom; import com.android.internal.telecom.IConnectionService; +import android.os.Handler; import android.os.RemoteException; import java.util.ArrayList; @@ -49,7 +50,7 @@ public final class RemoteConference { private final String mId; private final IConnectionService mConnectionService; - private final Set mCallbacks = new CopyOnWriteArraySet<>(); + private final Set> mCallbackRecords = new CopyOnWriteArraySet<>(); private final List mChildConnections = new CopyOnWriteArrayList<>(); private final List mUnmodifiableChildConnections = Collections.unmodifiableList(mChildConnections); @@ -77,13 +78,20 @@ public final class RemoteConference { for (RemoteConnection connection : mChildConnections) { connection.setConference(null); } - for (Callback c : mCallbacks) { - c.onDestroyed(this); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConference conference = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onDestroyed(conference); + } + }); } } /** {@hide} */ - void setState(int newState) { + void setState(final int newState) { if (newState != Connection.STATE_ACTIVE && newState != Connection.STATE_HOLDING && newState != Connection.STATE_DISCONNECTED) { @@ -93,42 +101,71 @@ public final class RemoteConference { } if (mState != newState) { - int oldState = mState; + final int oldState = mState; mState = newState; - for (Callback c : mCallbacks) { - c.onStateChanged(this, oldState, newState); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConference conference = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onStateChanged(conference, oldState, newState); + } + }); } } } /** {@hide} */ - void addConnection(RemoteConnection connection) { + void addConnection(final RemoteConnection connection) { if (!mChildConnections.contains(connection)) { mChildConnections.add(connection); connection.setConference(this); - for (Callback c : mCallbacks) { - c.onConnectionAdded(this, connection); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConference conference = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConnectionAdded(conference, connection); + } + }); } } } /** {@hide} */ - void removeConnection(RemoteConnection connection) { + void removeConnection(final RemoteConnection connection) { if (mChildConnections.contains(connection)) { mChildConnections.remove(connection); connection.setConference(null); - for (Callback c : mCallbacks) { - c.onConnectionRemoved(this, connection); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConference conference = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConnectionRemoved(conference, connection); + } + }); } } } /** {@hide} */ - void setConnectionCapabilities(int connectionCapabilities) { + void setConnectionCapabilities(final int connectionCapabilities) { if (mConnectionCapabilities != connectionCapabilities) { mConnectionCapabilities = connectionCapabilities; - for (Callback c : mCallbacks) { - c.onConnectionCapabilitiesChanged(this, mConnectionCapabilities); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConference conference = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConnectionCapabilitiesChanged( + conference, mConnectionCapabilities); + } + }); } } } @@ -137,18 +174,33 @@ public final class RemoteConference { void setConferenceableConnections(List conferenceableConnections) { mConferenceableConnections.clear(); mConferenceableConnections.addAll(conferenceableConnections); - for (Callback c : mCallbacks) { - c.onConferenceableConnectionsChanged(this, mUnmodifiableConferenceableConnections); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConference conference = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConferenceableConnectionsChanged( + conference, mUnmodifiableConferenceableConnections); + } + }); } } /** {@hide} */ - void setDisconnected(DisconnectCause disconnectCause) { + void setDisconnected(final DisconnectCause disconnectCause) { if (mState != Connection.STATE_DISCONNECTED) { mDisconnectCause = disconnectCause; setState(Connection.STATE_DISCONNECTED); - for (Callback c : mCallbacks) { - c.onDisconnected(this, disconnectCause); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConference conference = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onDisconnected(conference, disconnectCause); + } + }); } } } @@ -239,10 +291,24 @@ public final class RemoteConference { } public final void registerCallback(Callback callback) { - mCallbacks.add(callback); + registerCallback(callback, new Handler()); + } + + public final void registerCallback(Callback callback, Handler handler) { + unregisterCallback(callback); + if (callback != null && handler != null) { + mCallbackRecords.add(new CallbackRecord(callback, handler)); + } } public final void unregisterCallback(Callback callback) { - mCallbacks.remove(callback); + if (callback != null) { + for (CallbackRecord record : mCallbackRecords) { + if (record.getCallback() == callback) { + mCallbackRecords.remove(record); + break; + } + } + } } } diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index 0cbef8f288ec8..9ca9f316cd35e 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -21,6 +21,7 @@ import com.android.internal.telecom.IVideoCallback; import com.android.internal.telecom.IVideoProvider; import android.net.Uri; +import android.os.Handler; import android.os.IBinder; import android.os.RemoteException; import android.view.Surface; @@ -392,8 +393,8 @@ public final class RemoteConnection { * load factor before resizing, 1 means we only expect a single thread to * access the map so make only a single shard */ - private final Set mCallbacks = Collections.newSetFromMap( - new ConcurrentHashMap(8, 0.9f, 1)); + private final Set mCallbackRecords = Collections.newSetFromMap( + new ConcurrentHashMap(8, 0.9f, 1)); private final List mConferenceableConnections = new ArrayList<>(); private final List mUnmodifiableconferenceableConnections = Collections.unmodifiableList(mConferenceableConnections); @@ -470,7 +471,20 @@ public final class RemoteConnection { * @param callback A {@code Callback}. */ public void registerCallback(Callback callback) { - mCallbacks.add(callback); + registerCallback(callback, new Handler()); + } + + /** + * Adds a callback to this {@code RemoteConnection}. + * + * @param callback A {@code Callback}. + * @param handler A {@code Handler} which command and status changes will be delivered to. + */ + public void registerCallback(Callback callback, Handler handler) { + unregisterCallback(callback); + if (callback != null && handler != null) { + mCallbackRecords.add(new CallbackRecord(callback, handler)); + } } /** @@ -480,7 +494,12 @@ public final class RemoteConnection { */ public void unregisterCallback(Callback callback) { if (callback != null) { - mCallbacks.remove(callback); + for (CallbackRecord record : mCallbackRecords) { + if (record.getCallback() == callback) { + mCallbackRecords.remove(record); + break; + } + } } } @@ -800,11 +819,18 @@ public final class RemoteConnection { /** * @hide */ - void setState(int state) { + void setState(final int state) { if (mState != state) { mState = state; - for (Callback c: mCallbacks) { - c.onStateChanged(this, state); + for (CallbackRecord record: mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onStateChanged(connection, state); + } + }); } } } @@ -812,13 +838,20 @@ public final class RemoteConnection { /** * @hide */ - void setDisconnected(DisconnectCause disconnectCause) { + void setDisconnected(final DisconnectCause disconnectCause) { if (mState != Connection.STATE_DISCONNECTED) { mState = Connection.STATE_DISCONNECTED; mDisconnectCause = disconnectCause; - for (Callback c : mCallbacks) { - c.onDisconnected(this, mDisconnectCause); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onDisconnected(connection, disconnectCause); + } + }); } } } @@ -826,11 +859,18 @@ public final class RemoteConnection { /** * @hide */ - void setRingbackRequested(boolean ringback) { + void setRingbackRequested(final boolean ringback) { if (mRingbackRequested != ringback) { mRingbackRequested = ringback; - for (Callback c : mCallbacks) { - c.onRingbackRequested(this, ringback); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onRingbackRequested(connection, ringback); + } + }); } } } @@ -838,10 +878,17 @@ public final class RemoteConnection { /** * @hide */ - void setConnectionCapabilities(int connectionCapabilities) { + void setConnectionCapabilities(final int connectionCapabilities) { mConnectionCapabilities = connectionCapabilities; - for (Callback c : mCallbacks) { - c.onConnectionCapabilitiesChanged(this, connectionCapabilities); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConnectionCapabilitiesChanged(connection, connectionCapabilities); + } + }); } } @@ -849,17 +896,24 @@ public final class RemoteConnection { * @hide */ void setDestroyed() { - if (!mCallbacks.isEmpty()) { + if (!mCallbackRecords.isEmpty()) { // Make sure that the callbacks are notified that the call is destroyed first. if (mState != Connection.STATE_DISCONNECTED) { setDisconnected( new DisconnectCause(DisconnectCause.ERROR, "Connection destroyed.")); } - for (Callback c : mCallbacks) { - c.onDestroyed(this); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onDestroyed(connection); + } + }); } - mCallbacks.clear(); + mCallbackRecords.clear(); mConnected = false; } @@ -868,90 +922,162 @@ public final class RemoteConnection { /** * @hide */ - void setPostDialWait(String remainingDigits) { - for (Callback c : mCallbacks) { - c.onPostDialWait(this, remainingDigits); + void setPostDialWait(final String remainingDigits) { + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onPostDialWait(connection, remainingDigits); + } + }); } } /** * @hide */ - void onPostDialChar(char nextChar) { - for (Callback c : mCallbacks) { - c.onPostDialChar(this, nextChar); + void onPostDialChar(final char nextChar) { + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onPostDialWait(connection, String.valueOf(nextChar)); + } + }); } } /** * @hide */ - void setVideoState(int videoState) { + void setVideoState(final int videoState) { mVideoState = videoState; - for (Callback c : mCallbacks) { - c.onVideoStateChanged(this, videoState); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onVideoStateChanged(connection, videoState); + } + }); } } /** * @hide */ - void setVideoProvider(VideoProvider videoProvider) { + void setVideoProvider(final VideoProvider videoProvider) { mVideoProvider = videoProvider; - for (Callback c : mCallbacks) { - c.onVideoProviderChanged(this, videoProvider); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onVideoProviderChanged(connection, videoProvider); + } + }); } } /** @hide */ - void setIsVoipAudioMode(boolean isVoip) { + void setIsVoipAudioMode(final boolean isVoip) { mIsVoipAudioMode = isVoip; - for (Callback c : mCallbacks) { - c.onVoipAudioChanged(this, isVoip); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onVoipAudioChanged(connection, isVoip); + } + }); } } /** @hide */ - void setStatusHints(StatusHints statusHints) { + void setStatusHints(final StatusHints statusHints) { mStatusHints = statusHints; - for (Callback c : mCallbacks) { - c.onStatusHintsChanged(this, statusHints); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onStatusHintsChanged(connection, statusHints); + } + }); } } /** @hide */ - void setAddress(Uri address, int presentation) { + void setAddress(final Uri address, final int presentation) { mAddress = address; mAddressPresentation = presentation; - for (Callback c : mCallbacks) { - c.onAddressChanged(this, address, presentation); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onAddressChanged(connection, address, presentation); + } + }); } } /** @hide */ - void setCallerDisplayName(String callerDisplayName, int presentation) { + void setCallerDisplayName(final String callerDisplayName, final int presentation) { mCallerDisplayName = callerDisplayName; mCallerDisplayNamePresentation = presentation; - for (Callback c : mCallbacks) { - c.onCallerDisplayNameChanged(this, callerDisplayName, presentation); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onCallerDisplayNameChanged( + connection, callerDisplayName, presentation); + } + }); } } /** @hide */ - void setConferenceableConnections(List conferenceableConnections) { + void setConferenceableConnections(final List conferenceableConnections) { mConferenceableConnections.clear(); mConferenceableConnections.addAll(conferenceableConnections); - for (Callback c : mCallbacks) { - c.onConferenceableConnectionsChanged(this, mUnmodifiableconferenceableConnections); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConferenceableConnectionsChanged( + connection, mUnmodifiableconferenceableConnections); + } + }); } } /** @hide */ - void setConference(RemoteConference conference) { + void setConference(final RemoteConference conference) { if (mConference != conference) { mConference = conference; - for (Callback c : mCallbacks) { - c.onConferenceChanged(this, conference); + for (CallbackRecord record : mCallbackRecords) { + final RemoteConnection connection = this; + final Callback callback = record.getCallback(); + record.getHandler().post(new Runnable() { + @Override + public void run() { + callback.onConferenceChanged(connection, conference); + } + }); } } } @@ -968,4 +1094,22 @@ public final class RemoteConnection { public static RemoteConnection failure(DisconnectCause disconnectCause) { return new RemoteConnection(disconnectCause); } + + private static final class CallbackRecord extends Callback { + private final Callback mCallback; + private final Handler mHandler; + + public CallbackRecord(Callback callback, Handler handler) { + mCallback = callback; + mHandler = handler; + } + + public Callback getCallback() { + return mCallback; + } + + public Handler getHandler() { + return mHandler; + } + } } diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java index a23d4d661efdc..0af098f7957e4 100644 --- a/telecomm/java/android/telecom/VideoCallImpl.java +++ b/telecomm/java/android/telecom/VideoCallImpl.java @@ -36,13 +36,6 @@ import com.android.internal.telecom.IVideoProvider; * {@hide} */ public class VideoCallImpl extends VideoCall { - private static final int MSG_RECEIVE_SESSION_MODIFY_REQUEST = 1; - private static final int MSG_RECEIVE_SESSION_MODIFY_RESPONSE = 2; - private static final int MSG_HANDLE_CALL_SESSION_EVENT = 3; - private static final int MSG_CHANGE_PEER_DIMENSIONS = 4; - private static final int MSG_CHANGE_CALL_DATA_USAGE = 5; - private static final int MSG_CHANGE_CAMERA_CAPABILITIES = 6; - private static final int MSG_CHANGE_VIDEO_QUALITY = 7; private final IVideoProvider mVideoProvider; private final VideoCallListenerBinder mBinder; @@ -63,7 +56,7 @@ public class VideoCallImpl extends VideoCall { private final class VideoCallListenerBinder extends IVideoCallback.Stub { @Override public void receiveSessionModifyRequest(VideoProfile videoProfile) { - mHandler.obtainMessage(MSG_RECEIVE_SESSION_MODIFY_REQUEST, + mHandler.obtainMessage(MessageHandler.MSG_RECEIVE_SESSION_MODIFY_REQUEST, videoProfile).sendToTarget(); } @@ -74,12 +67,14 @@ public class VideoCallImpl extends VideoCall { args.arg1 = status; args.arg2 = requestProfile; args.arg3 = responseProfile; - mHandler.obtainMessage(MSG_RECEIVE_SESSION_MODIFY_RESPONSE, args).sendToTarget(); + mHandler.obtainMessage(MessageHandler.MSG_RECEIVE_SESSION_MODIFY_RESPONSE, args) + .sendToTarget(); } @Override public void handleCallSessionEvent(int event) { - mHandler.obtainMessage(MSG_HANDLE_CALL_SESSION_EVENT, event).sendToTarget(); + mHandler.obtainMessage(MessageHandler.MSG_HANDLE_CALL_SESSION_EVENT, event) + .sendToTarget(); } @Override @@ -87,28 +82,42 @@ public class VideoCallImpl extends VideoCall { SomeArgs args = SomeArgs.obtain(); args.arg1 = width; args.arg2 = height; - mHandler.obtainMessage(MSG_CHANGE_PEER_DIMENSIONS, args).sendToTarget(); + mHandler.obtainMessage(MessageHandler.MSG_CHANGE_PEER_DIMENSIONS, args).sendToTarget(); } @Override public void changeVideoQuality(int videoQuality) { - mHandler.obtainMessage(MSG_CHANGE_VIDEO_QUALITY, videoQuality, 0).sendToTarget(); + mHandler.obtainMessage(MessageHandler.MSG_CHANGE_VIDEO_QUALITY, videoQuality, 0) + .sendToTarget(); } @Override public void changeCallDataUsage(long dataUsage) { - mHandler.obtainMessage(MSG_CHANGE_CALL_DATA_USAGE, dataUsage).sendToTarget(); + mHandler.obtainMessage(MessageHandler.MSG_CHANGE_CALL_DATA_USAGE, dataUsage) + .sendToTarget(); } @Override public void changeCameraCapabilities(CameraCapabilities cameraCapabilities) { - mHandler.obtainMessage(MSG_CHANGE_CAMERA_CAPABILITIES, + mHandler.obtainMessage(MessageHandler.MSG_CHANGE_CAMERA_CAPABILITIES, cameraCapabilities).sendToTarget(); } } /** Default handler used to consolidate binder method calls onto a single thread. */ - private final Handler mHandler = new Handler(Looper.getMainLooper()) { + private final class MessageHandler extends Handler { + private static final int MSG_RECEIVE_SESSION_MODIFY_REQUEST = 1; + private static final int MSG_RECEIVE_SESSION_MODIFY_RESPONSE = 2; + private static final int MSG_HANDLE_CALL_SESSION_EVENT = 3; + private static final int MSG_CHANGE_PEER_DIMENSIONS = 4; + private static final int MSG_CHANGE_CALL_DATA_USAGE = 5; + private static final int MSG_CHANGE_CAMERA_CAPABILITIES = 6; + private static final int MSG_CHANGE_VIDEO_QUALITY = 7; + + public MessageHandler(Looper looper) { + super(looper); + } + @Override public void handleMessage(Message msg) { if (mCallback == null) { @@ -163,6 +172,8 @@ public class VideoCallImpl extends VideoCall { } }; + private Handler mHandler; + /** {@hide} */ VideoCallImpl(IVideoProvider videoProvider, Call call) throws RemoteException { mVideoProvider = videoProvider; @@ -173,13 +184,31 @@ public class VideoCallImpl extends VideoCall { mCall = call; } - /** {@inheritDoc} */ - public void registerCallback(VideoCall.Callback callback) { - mCallback = callback; + public void destroy() { + unregisterCallback(mCallback); } /** {@inheritDoc} */ - public void unregisterCallback() { + public void registerCallback(VideoCall.Callback callback) { + registerCallback(callback, null); + } + + /** {@inheritDoc} */ + public void registerCallback(VideoCall.Callback callback, Handler handler) { + mCallback = callback; + if (handler == null) { + mHandler = new MessageHandler(Looper.getMainLooper()); + } else { + mHandler = new MessageHandler(handler.getLooper()); + } + } + + /** {@inheritDoc} */ + public void unregisterCallback(VideoCall.Callback callback) { + if (callback != mCallback) { + return; + } + mCallback = null; try { mVideoProvider.removeVideoCallback(mBinder); From 39465f9d8a6cfe5f6117248f10247fb721ab5468 Mon Sep 17 00:00:00 2001 From: Santos Cordon Date: Thu, 23 Apr 2015 14:44:19 -0700 Subject: [PATCH 04/29] DO NOT MERGE Remove CallState and rename PRE_DIAL_WAIT Bug: 20532827 Bug: 20532435 Change-Id: I5f0308c5cf4e4a9cf9020b4fe7fa5f3f8dee6e67 --- api/current.txt | 16 +-- api/system-current.txt | 17 +-- telecomm/java/android/telecom/Call.java | 43 ++---- telecomm/java/android/telecom/CallState.java | 134 ------------------- 4 files changed, 15 insertions(+), 195 deletions(-) delete mode 100644 telecomm/java/android/telecom/CallState.java diff --git a/api/current.txt b/api/current.txt index 3d4b86eb9db6f..8b2c3793e361d 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28366,8 +28366,8 @@ package android.telecom { field public static final int STATE_DISCONNECTING = 10; // 0xa field public static final int STATE_HOLDING = 3; // 0x3 field public static final int STATE_NEW = 0; // 0x0 - field public static final int STATE_PRE_DIAL_WAIT = 8; // 0x8 field public static final int STATE_RINGING = 2; // 0x2 + field public static final int STATE_SELECT_PHONE_ACCOUNT = 8; // 0x8 } public static abstract class Call.Callback { @@ -28426,20 +28426,6 @@ package android.telecom { field public static final int PROPERTY_WIFI = 8; // 0x8 } - public final class CallState { - method public static java.lang.String toString(int); - field public static final int ABORTED = 8; // 0x8 - field public static final int ACTIVE = 5; // 0x5 - field public static final int CONNECTING = 1; // 0x1 - field public static final int DIALING = 3; // 0x3 - field public static final int DISCONNECTED = 7; // 0x7 - field public static final int DISCONNECTING = 9; // 0x9 - field public static final int NEW = 0; // 0x0 - field public static final int ON_HOLD = 6; // 0x6 - field public static final int PRE_DIAL_WAIT = 2; // 0x2 - field public static final int RINGING = 4; // 0x4 - } - public final class CameraCapabilities implements android.os.Parcelable { ctor public CameraCapabilities(int, int); method public int describeContents(); diff --git a/api/system-current.txt b/api/system-current.txt index d4e728caf5ea2..f15a66ceba134 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30183,8 +30183,9 @@ package android.telecom { field public static final int STATE_DISCONNECTING = 10; // 0xa field public static final int STATE_HOLDING = 3; // 0x3 field public static final int STATE_NEW = 0; // 0x0 - field public static final int STATE_PRE_DIAL_WAIT = 8; // 0x8 + field public static final deprecated int STATE_PRE_DIAL_WAIT = 8; // 0x8 field public static final int STATE_RINGING = 2; // 0x2 + field public static final int STATE_SELECT_PHONE_ACCOUNT = 8; // 0x8 } public static abstract class Call.Callback { @@ -30247,20 +30248,6 @@ package android.telecom { ctor public Call.Listener(); } - public final class CallState { - method public static java.lang.String toString(int); - field public static final int ABORTED = 8; // 0x8 - field public static final int ACTIVE = 5; // 0x5 - field public static final int CONNECTING = 1; // 0x1 - field public static final int DIALING = 3; // 0x3 - field public static final int DISCONNECTED = 7; // 0x7 - field public static final int DISCONNECTING = 9; // 0x9 - field public static final int NEW = 0; // 0x0 - field public static final int ON_HOLD = 6; // 0x6 - field public static final int PRE_DIAL_WAIT = 2; // 0x2 - field public static final int RINGING = 4; // 0x4 - } - public final class CameraCapabilities implements android.os.Parcelable { ctor public CameraCapabilities(int, int); method public int describeContents(); diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index 437dc44e1e62b..adab00bb1e25e 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -68,9 +68,18 @@ public final class Call { public static final int STATE_DISCONNECTED = 7; /** - * The state of an outgoing {@code Call}, but waiting for user input before proceeding. + * The state of an outgoing {@code Call} when waiting on user to select a + * {@link PhoneAccount} through which to place the call. */ - public static final int STATE_PRE_DIAL_WAIT = 8; + public static final int STATE_SELECT_PHONE_ACCOUNT = 8; + + /** + * @hide + * @deprecated use STATE_SELECT_PHONE_ACCOUNT. + */ + @Deprecated + @SystemApi + public static final int STATE_PRE_DIAL_WAIT = STATE_SELECT_PHONE_ACCOUNT; /** * The initial state of an outgoing {@code Call}. @@ -996,7 +1005,7 @@ public final class Call { mVideoCall = parcelableCall.getVideoCall(this); } - int state = stateFromParcelableCallState(parcelableCall.getState()); + int state = parcelableCall.getState(); boolean stateChanged = mState != state; if (stateChanged) { mState = state; @@ -1194,32 +1203,4 @@ public final class Call { }); } } - - private int stateFromParcelableCallState(int parcelableCallState) { - switch (parcelableCallState) { - case CallState.NEW: - return STATE_NEW; - case CallState.CONNECTING: - return STATE_CONNECTING; - case CallState.PRE_DIAL_WAIT: - return STATE_PRE_DIAL_WAIT; - case CallState.DIALING: - return STATE_DIALING; - case CallState.RINGING: - return STATE_RINGING; - case CallState.ACTIVE: - return STATE_ACTIVE; - case CallState.ON_HOLD: - return STATE_HOLDING; - case CallState.DISCONNECTED: - return STATE_DISCONNECTED; - case CallState.ABORTED: - return STATE_DISCONNECTED; - case CallState.DISCONNECTING: - return STATE_DISCONNECTING; - default: - Log.wtf(this, "Unrecognized CallState %s", parcelableCallState); - return STATE_NEW; - } - } } diff --git a/telecomm/java/android/telecom/CallState.java b/telecomm/java/android/telecom/CallState.java deleted file mode 100644 index 558422622a066..0000000000000 --- a/telecomm/java/android/telecom/CallState.java +++ /dev/null @@ -1,134 +0,0 @@ -/* - * Copyright 2014, 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. - */ - -package android.telecom; - -/** - * Defines call-state constants of the different states in which a call can exist. Although states - * have the notion of normal transitions, due to the volatile nature of telephony systems, code - * that uses these states should be resilient to unexpected state changes outside of what is - * considered traditional. - */ -public final class CallState { - - private CallState() {} - - /** - * Indicates that a call is new and not connected. This is used as the default state internally - * within Telecom and should not be used between Telecom and call services. Call services are - * not expected to ever interact with NEW calls, but {@link InCallService}s will see calls in - * this state. - */ - public static final int NEW = 0; - - /** - * The initial state of an outgoing {@code Call}. - * Common transitions are to {@link #DIALING} state for a successful call or - * {@link #DISCONNECTED} if it failed. - */ - public static final int CONNECTING = 1; - - /** - * Indicates that the call is about to go into the outgoing and dialing state but is waiting for - * user input before it proceeds. For example, where no default {@link PhoneAccount} is set, - * this is the state where the InCallUI is waiting for the user to select a - * {@link PhoneAccount} to call from. - */ - public static final int PRE_DIAL_WAIT = 2; - - /** - * Indicates that a call is outgoing and in the dialing state. A call transitions to this state - * once an outgoing call has begun (e.g., user presses the dial button in Dialer). Calls in this - * state usually transition to {@link #ACTIVE} if the call was answered or {@link #DISCONNECTED} - * if the call was disconnected somehow (e.g., failure or cancellation of the call by the user). - */ - public static final int DIALING = 3; - - /** - * Indicates that a call is incoming and the user still has the option of answering, rejecting, - * or doing nothing with the call. This state is usually associated with some type of audible - * ringtone. Normal transitions are to {@link #ACTIVE} if answered or {@link #DISCONNECTED} - * otherwise. - */ - public static final int RINGING = 4; - - /** - * Indicates that a call is currently connected to another party and a communication channel is - * open between them. The normal transition to this state is by the user answering a - * {@link #DIALING} call or a {@link #RINGING} call being answered by the other party. - */ - public static final int ACTIVE = 5; - - /** - * Indicates that the call is currently on hold. In this state, the call is not terminated - * but no communication is allowed until the call is no longer on hold. The typical transition - * to this state is by the user putting an {@link #ACTIVE} call on hold by explicitly performing - * an action, such as clicking the hold button. - */ - public static final int ON_HOLD = 6; - - /** - * Indicates that a call is currently disconnected. All states can transition to this state - * by the call service giving notice that the connection has been severed. When the user - * explicitly ends a call, it will not transition to this state until the call service confirms - * the disconnection or communication was lost to the call service currently responsible for - * this call (e.g., call service crashes). - */ - public static final int DISCONNECTED = 7; - - /** - * Indicates that the call was attempted (mostly in the context of outgoing, at least at the - * time of writing) but cancelled before it was successfully connected. - */ - public static final int ABORTED = 8; - - /** - * Indicates that the call is in the process of being disconnected and will transition next - * to a {@link #DISCONNECTED} state. - *

- * This state is not expected to be communicated from the Telephony layer, but will be reported - * to the InCall UI for calls where disconnection has been initiated by the user but the - * ConnectionService has confirmed the call as disconnected. - */ - public static final int DISCONNECTING = 9; - - public static String toString(int callState) { - switch (callState) { - case NEW: - return "NEW"; - case CONNECTING: - return "CONNECTING"; - case PRE_DIAL_WAIT: - return "PRE_DIAL_WAIT"; - case DIALING: - return "DIALING"; - case RINGING: - return "RINGING"; - case ACTIVE: - return "ACTIVE"; - case ON_HOLD: - return "ON_HOLD"; - case DISCONNECTED: - return "DISCONNECTED"; - case ABORTED: - return "ABORTED"; - case DISCONNECTING: - return "DISCONNECTING"; - default: - return "UNKNOWN"; - } - } -} From 2ac9f1e1fb919c3a3405452e725437d1dfa8665a Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Sun, 26 Apr 2015 17:04:29 -0700 Subject: [PATCH 05/29] [DO NOT MERGE] Honor Ble scanning settings from Settings UI. Bug:20643039 Change-Id: Ib1465108e26b8537c9da1bfbb31a99d2e33da910 --- .../android/bluetooth/BluetoothAdapter.java | 31 ++++++------------- .../android/bluetooth/IBluetoothManager.aidl | 2 ++ .../server/BluetoothManagerService.java | 11 +++++++ 3 files changed, 22 insertions(+), 22 deletions(-) diff --git a/core/java/android/bluetooth/BluetoothAdapter.java b/core/java/android/bluetooth/BluetoothAdapter.java index 3efbc2da377b4..b2519ca700e65 100644 --- a/core/java/android/bluetooth/BluetoothAdapter.java +++ b/core/java/android/bluetooth/BluetoothAdapter.java @@ -36,6 +36,7 @@ import android.os.RemoteException; import android.os.ServiceManager; import android.app.ActivityThread; import android.os.SystemProperties; +import android.provider.Settings; import android.os.Binder; import android.util.Log; import android.util.Pair; @@ -634,24 +635,6 @@ public final class BluetoothAdapter { } } - /** - * Returns true if LE only mode is enabled, that is apps - * have authorization to turn only BT ON and the calling - * app has privilage to do so - */ - private boolean isLEAlwaysOnEnabled() { - boolean ret = false; - if (SystemProperties.getBoolean("ro.bluetooth.blealwayson", true) == true) { - Log.v(TAG, "LE always on mode is enabled"); - // TODO: System API authorization check - ret = true; - } else { - Log.v(TAG, "LE always on mode is disabled"); - ret = false; - } - return ret; - } - /** * Turns off Bluetooth LE which was earlier turned on by calling EnableBLE(). * @@ -679,7 +662,7 @@ public final class BluetoothAdapter { * @hide */ public boolean disableBLE() { - if (isLEAlwaysOnEnabled() != true) return false; + if (!isBleScanAlwaysAvailable()) return false; int state = getLeState(); if (state == BluetoothAdapter.STATE_ON) { @@ -741,7 +724,7 @@ public final class BluetoothAdapter { * @hide */ public boolean enableBLE() { - if (isLEAlwaysOnEnabled() != true) return false; + if (!isBleScanAlwaysAvailable()) return false; if (isLeEnabled() == true) { if (DBG) Log.d(TAG, "enableBLE(): BT is already enabled..!"); @@ -1247,8 +1230,12 @@ public final class BluetoothAdapter { */ @SystemApi public boolean isBleScanAlwaysAvailable() { - // TODO: implement after Settings UI change. - return false; + try { + return mManagerService.isBleScanAlwaysAvailable(); + } catch (RemoteException e) { + Log.e(TAG, "remote expection when calling isBleScanAlwaysAvailable", e); + return false; + } } /** diff --git a/core/java/android/bluetooth/IBluetoothManager.aidl b/core/java/android/bluetooth/IBluetoothManager.aidl index 8d1ce990a5626..0b81ee8c547e3 100644 --- a/core/java/android/bluetooth/IBluetoothManager.aidl +++ b/core/java/android/bluetooth/IBluetoothManager.aidl @@ -44,6 +44,8 @@ interface IBluetoothManager String getAddress(); String getName(); + + boolean isBleScanAlwaysAvailable(); int updateBleAppCount(IBinder b, boolean enable); boolean isBleAppPresent(); } diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 5d353b6372fac..2cc5ff0601d67 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -48,6 +48,7 @@ import android.os.SystemClock; import android.os.UserHandle; import android.os.UserManager; import android.provider.Settings; +import android.provider.Settings.SettingNotFoundException; import android.util.Log; import java.io.FileDescriptor; @@ -445,6 +446,16 @@ class BluetoothManagerService extends IBluetoothManager.Stub { /** Internal death rec list */ Map mBleApps = new HashMap(); + @Override + public boolean isBleScanAlwaysAvailable() { + try { + return (Settings.Global.getInt(mContentResolver, + Settings.Global.BLE_SCAN_ALWAYS_AVAILABLE)) != 0; + } catch (SettingNotFoundException e) { + } + return false; + } + public int updateBleAppCount(IBinder token, boolean enable) { if (enable) { ClientDeathRecipient r = mBleApps.get(token); From 9225cc4f2e58673f9ebad31a3234d5b2cc3ef920 Mon Sep 17 00:00:00 2001 From: Wei Wang Date: Fri, 1 May 2015 00:50:32 -0700 Subject: [PATCH 06/29] [DO NOT MERGE] Fix a bug in ScanSettings constructor. Change-Id: I36e6effe8063bacddd61fe2c47c0360d7ffaee71 --- core/java/android/bluetooth/le/ScanSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/java/android/bluetooth/le/ScanSettings.java b/core/java/android/bluetooth/le/ScanSettings.java index abe3efd7741da..4eeb577a1deae 100644 --- a/core/java/android/bluetooth/le/ScanSettings.java +++ b/core/java/android/bluetooth/le/ScanSettings.java @@ -178,7 +178,7 @@ public final class ScanSettings implements Parcelable { mScanResultType = scanResultType; mReportDelayMillis = reportDelayMillis; mNumOfMatchesPerFilter = numOfMatchesPerFilter; - mMatchMode = numOfMatchesPerFilter; + mMatchMode = matchMode; } private ScanSettings(Parcel in) { From 2b5b6602030237cd14f832bf456097495374f39f Mon Sep 17 00:00:00 2001 From: Tyler Gunn Date: Fri, 8 May 2015 14:54:23 -0700 Subject: [PATCH 07/29] DO NOT MERGE Un-@hiding some missed VT APIs. Bug: 20947116 Change-Id: Idda9b7c7debafbea8c42eaadb75c3375b2c8ddb2 --- api/current.txt | 17 +++++++++++++++++ api/system-current.txt | 17 +++++++++++++++++ telecomm/java/android/telecom/Conference.java | 4 ---- telecomm/java/android/telecom/Connection.java | 11 ----------- .../java/android/telecom/ConnectionRequest.java | 2 -- .../java/android/telecom/ConnectionService.java | 1 - 6 files changed, 34 insertions(+), 18 deletions(-) diff --git a/api/current.txt b/api/current.txt index 8b2c3793e361d..5502f8643680a 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28449,6 +28449,8 @@ package android.telecom { method public android.telecom.Connection getPrimaryConnection(); method public final int getState(); method public final android.telecom.StatusHints getStatusHints(); + method public android.telecom.Connection.VideoProvider getVideoProvider(); + method public int getVideoState(); method public void onAudioStateChanged(android.telecom.AudioState); method public void onConnectionAdded(android.telecom.Connection); method public void onDisconnect(); @@ -28468,6 +28470,8 @@ package android.telecom { method public final void setDisconnected(android.telecom.DisconnectCause); method public final void setOnHold(); method public final void setStatusHints(android.telecom.StatusHints); + method public final void setVideoProvider(android.telecom.Connection, android.telecom.Connection.VideoProvider); + method public final void setVideoState(android.telecom.Connection, int); field public static final long CONNECT_TIME_NOT_SPECIFIED = 0L; // 0x0L } @@ -28492,6 +28496,7 @@ package android.telecom { method public final android.telecom.Connection.VideoProvider getVideoProvider(); method public final boolean isRingbackRequested(); method public void onAbort(); + method public void onAnswer(int); method public void onAnswer(); method public void onAudioStateChanged(android.telecom.AudioState); method public void onDisconnect(); @@ -28520,7 +28525,11 @@ package android.telecom { method public final void setRingbackRequested(boolean); method public final void setRinging(); method public final void setStatusHints(android.telecom.StatusHints); + method public final void setVideoProvider(android.telecom.Connection.VideoProvider); + method public final void setVideoState(int); method public static java.lang.String stateToString(int); + field public static final int CAPABILITY_CAN_PAUSE_VIDEO = 1048576; // 0x100000 + field public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 524288; // 0x80000 field public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000 field public static final int CAPABILITY_HOLD = 1; // 0x1 field public static final int CAPABILITY_MANAGE_CONFERENCE = 128; // 0x80 @@ -28528,6 +28537,12 @@ package android.telecom { field public static final int CAPABILITY_MUTE = 64; // 0x40 field public static final int CAPABILITY_RESPOND_VIA_TEXT = 32; // 0x20 field public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 4096; // 0x1000 + field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = 768; // 0x300 + field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_RX = 256; // 0x100 + field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_TX = 512; // 0x200 + field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL = 3072; // 0xc00 + field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_RX = 1024; // 0x400 + field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_TX = 2048; // 0x800 field public static final int CAPABILITY_SUPPORT_HOLD = 2; // 0x2 field public static final int CAPABILITY_SWAP_CONFERENCE = 8; // 0x8 field public static final int STATE_ACTIVE = 4; // 0x4 @@ -28573,10 +28588,12 @@ package android.telecom { public final class ConnectionRequest implements android.os.Parcelable { ctor public ConnectionRequest(android.telecom.PhoneAccountHandle, android.net.Uri, android.os.Bundle); + ctor public ConnectionRequest(android.telecom.PhoneAccountHandle, android.net.Uri, android.os.Bundle, int); method public int describeContents(); method public android.telecom.PhoneAccountHandle getAccountHandle(); method public android.net.Uri getAddress(); method public android.os.Bundle getExtras(); + method public int getVideoState(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; } diff --git a/api/system-current.txt b/api/system-current.txt index f15a66ceba134..5d2d5e93c46ec 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30271,6 +30271,8 @@ package android.telecom { method public android.telecom.Connection getPrimaryConnection(); method public final int getState(); method public final android.telecom.StatusHints getStatusHints(); + method public android.telecom.Connection.VideoProvider getVideoProvider(); + method public int getVideoState(); method public void onAudioStateChanged(android.telecom.AudioState); method public void onConnectionAdded(android.telecom.Connection); method public void onDisconnect(); @@ -30290,6 +30292,8 @@ package android.telecom { method public final void setDisconnected(android.telecom.DisconnectCause); method public final void setOnHold(); method public final void setStatusHints(android.telecom.StatusHints); + method public final void setVideoProvider(android.telecom.Connection, android.telecom.Connection.VideoProvider); + method public final void setVideoState(android.telecom.Connection, int); field public static final long CONNECT_TIME_NOT_SPECIFIED = 0L; // 0x0L } @@ -30314,6 +30318,7 @@ package android.telecom { method public final android.telecom.Connection.VideoProvider getVideoProvider(); method public final boolean isRingbackRequested(); method public void onAbort(); + method public void onAnswer(int); method public void onAnswer(); method public void onAudioStateChanged(android.telecom.AudioState); method public void onDisconnect(); @@ -30342,7 +30347,11 @@ package android.telecom { method public final void setRingbackRequested(boolean); method public final void setRinging(); method public final void setStatusHints(android.telecom.StatusHints); + method public final void setVideoProvider(android.telecom.Connection.VideoProvider); + method public final void setVideoState(int); method public static java.lang.String stateToString(int); + field public static final int CAPABILITY_CAN_PAUSE_VIDEO = 1048576; // 0x100000 + field public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 524288; // 0x80000 field public static final int CAPABILITY_DISCONNECT_FROM_CONFERENCE = 8192; // 0x2000 field public static final int CAPABILITY_HOLD = 1; // 0x1 field public static final int CAPABILITY_MANAGE_CONFERENCE = 128; // 0x80 @@ -30350,6 +30359,12 @@ package android.telecom { field public static final int CAPABILITY_MUTE = 64; // 0x40 field public static final int CAPABILITY_RESPOND_VIA_TEXT = 32; // 0x20 field public static final int CAPABILITY_SEPARATE_FROM_CONFERENCE = 4096; // 0x1000 + field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = 768; // 0x300 + field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_RX = 256; // 0x100 + field public static final int CAPABILITY_SUPPORTS_VT_LOCAL_TX = 512; // 0x200 + field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL = 3072; // 0xc00 + field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_RX = 1024; // 0x400 + field public static final int CAPABILITY_SUPPORTS_VT_REMOTE_TX = 2048; // 0x800 field public static final int CAPABILITY_SUPPORT_HOLD = 2; // 0x2 field public static final int CAPABILITY_SWAP_CONFERENCE = 8; // 0x8 field public static final int STATE_ACTIVE = 4; // 0x4 @@ -30395,10 +30410,12 @@ package android.telecom { public final class ConnectionRequest implements android.os.Parcelable { ctor public ConnectionRequest(android.telecom.PhoneAccountHandle, android.net.Uri, android.os.Bundle); + ctor public ConnectionRequest(android.telecom.PhoneAccountHandle, android.net.Uri, android.os.Bundle, int); method public int describeContents(); method public android.telecom.PhoneAccountHandle getAccountHandle(); method public android.net.Uri getAddress(); method public android.os.Bundle getExtras(); + method public int getVideoState(); method public void writeToParcel(android.os.Parcel, int); field public static final android.os.Parcelable.Creator CREATOR; } diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index 3acf9458b9c12..eb0ae9e01fde5 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -179,7 +179,6 @@ public abstract class Conference implements IConferenceable { /** * Returns VideoProvider of the primary call. This can be null. - * @hide */ public VideoProvider getVideoProvider() { return null; @@ -187,7 +186,6 @@ public abstract class Conference implements IConferenceable { /** * Returns video state of the primary call. - * @hide */ public int getVideoState() { return VideoProfile.VideoState.AUDIO_ONLY; @@ -373,7 +371,6 @@ public abstract class Conference implements IConferenceable { * {@link VideoProfile.VideoState#RX_ENABLED}. * * @param videoState The new video state. - * @hide */ public final void setVideoState(Connection c, int videoState) { Log.d(this, "setVideoState Conference: %s Connection: %s VideoState: %s", @@ -387,7 +384,6 @@ public abstract class Conference implements IConferenceable { * Sets the video connection provider. * * @param videoProvider The video provider. - * @hide */ public final void setVideoProvider(Connection c, Connection.VideoProvider videoProvider) { Log.d(this, "setVideoProvider Conference: %s Connection: %s VideoState: %s", diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 2fa412468cd1e..baddfa2825e33 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -106,38 +106,32 @@ public abstract class Connection implements IConferenceable { /** * Local device supports receiving video. - * @hide */ public static final int CAPABILITY_SUPPORTS_VT_LOCAL_RX = 0x00000100; /** * Local device supports transmitting video. - * @hide */ public static final int CAPABILITY_SUPPORTS_VT_LOCAL_TX = 0x00000200; /** * Local device supports bidirectional video calling. - * @hide */ public static final int CAPABILITY_SUPPORTS_VT_LOCAL_BIDIRECTIONAL = CAPABILITY_SUPPORTS_VT_LOCAL_RX | CAPABILITY_SUPPORTS_VT_LOCAL_TX; /** * Remote device supports receiving video. - * @hide */ public static final int CAPABILITY_SUPPORTS_VT_REMOTE_RX = 0x00000400; /** * Remote device supports transmitting video. - * @hide */ public static final int CAPABILITY_SUPPORTS_VT_REMOTE_TX = 0x00000800; /** * Remote device supports bidirectional video calling. - * @hide */ public static final int CAPABILITY_SUPPORTS_VT_REMOTE_BIDIRECTIONAL = CAPABILITY_SUPPORTS_VT_REMOTE_RX | CAPABILITY_SUPPORTS_VT_REMOTE_TX; @@ -187,14 +181,12 @@ public abstract class Connection implements IConferenceable { /** * Call can be upgraded to a video call. - * @hide */ public static final int CAPABILITY_CAN_UPGRADE_TO_VIDEO = 0x00080000; /** * For video calls, indicates whether the outgoing video for the call can be paused using * the {@link android.telecom.VideoProfile.VideoState#PAUSED} VideoState. - * @hide */ public static final int CAPABILITY_CAN_PAUSE_VIDEO = 0x00100000; @@ -1041,7 +1033,6 @@ public abstract class Connection implements IConferenceable { * {@link VideoProfile.VideoState#RX_ENABLED}. * * @param videoState The new video state. - * @hide */ public final void setVideoState(int videoState) { checkImmutable(); @@ -1105,7 +1096,6 @@ public abstract class Connection implements IConferenceable { /** * Sets the video connection provider. * @param videoProvider The video provider. - * @hide */ public final void setVideoProvider(VideoProvider videoProvider) { checkImmutable(); @@ -1417,7 +1407,6 @@ public abstract class Connection implements IConferenceable { * a request to accept. * * @param videoState The video state in which to answer the connection. - * @hide */ public void onAnswer(int videoState) {} diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java index 71b481b89c771..f5cceea80060e 100644 --- a/telecomm/java/android/telecom/ConnectionRequest.java +++ b/telecomm/java/android/telecom/ConnectionRequest.java @@ -50,7 +50,6 @@ public final class ConnectionRequest implements Parcelable { * @param handle The handle (e.g., phone number) to which the {@link Connection} is to connect. * @param extras Application-specific extra data. * @param videoState Determines the video state for the connection. - * @hide */ public ConnectionRequest( PhoneAccountHandle accountHandle, @@ -95,7 +94,6 @@ public final class ConnectionRequest implements Parcelable { * {@link VideoProfile.VideoState#RX_ENABLED}. * * @return The video state for the connection. - * @hide */ public int getVideoState() { return mVideoState; diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 984382410e3b0..d8599d13c7276 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -147,7 +147,6 @@ public abstract class ConnectionService extends Service { } @Override - /** @hide */ public void answerVideo(String callId, int videoState) { SomeArgs args = SomeArgs.obtain(); args.arg1 = callId; From 216d8c3635e0fd8da730616d89ec0ea2ce10be76 Mon Sep 17 00:00:00 2001 From: Pierre Vandwalle Date: Fri, 8 May 2015 16:07:04 -0700 Subject: [PATCH 08/29] fix null pointer crash Bug:20232584 Change-Id: I7c46e372bc8f3a54b0428ef56c034eb2c79133ea --- wifi/java/android/net/wifi/WifiManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index 2058645a4a355..ba045baff54d3 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -994,7 +994,7 @@ public class WifiManager { } synchronized(this) { record = mService.reportActivityInfo(); - if (record.isValid()) { + if (record != null && record.isValid()) { return record; } else { return null; From a8fc387e20818e902b1140d4e17fb3b40ae4e5a6 Mon Sep 17 00:00:00 2001 From: Robert Greenwalt Date: Mon, 11 May 2015 17:54:13 -0700 Subject: [PATCH 09/29] Add support for static RadioCapabilities. Some RILs don't support RIL_REQUEST_GET_RADIO_CAPABILITY. Add code to RIL.java to notice a REQUEST_NOT_SUPPORTED response and check config.xml (config_radio_access_family) for a static answer. Also catching GENERIC_FAILURE responses because Hammerhead modem returns that. B 21079604 created for this. If neither Modem nor config.xml provide data, uses RAF_UNKNOWN so we don't lie about capabilities and also so we fail fast (setPreferredNetwork won't work). bug:20561357 Change-Id: I9607e8e99242c6f7a6e330741d4afe8bbd08b1e7 --- core/res/res/values/config.xml | 7 ++++ core/res/res/values/symbols.xml | 1 + .../android/telephony/RadioAccessFamily.java | 40 ++++++++++++++++++- 3 files changed, 47 insertions(+), 1 deletion(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index c22a1cbc663a2..e91831a3327b1 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -2066,4 +2066,11 @@ true + + + + diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index d33f667f5d0ec..03147cfd418b6 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -2179,4 +2179,5 @@ + diff --git a/telephony/java/android/telephony/RadioAccessFamily.java b/telephony/java/android/telephony/RadioAccessFamily.java index 9fea418b82c8b..0c5c5577d5111 100644 --- a/telephony/java/android/telephony/RadioAccessFamily.java +++ b/telephony/java/android/telephony/RadioAccessFamily.java @@ -255,5 +255,43 @@ public class RadioAccessFamily implements Parcelable { return type; } -} + public static int singleRafTypeFromString(String rafString) { + switch (rafString) { + case "GPRS": return RAF_GPRS; + case "EDGE": return RAF_EDGE; + case "UMTS": return RAF_UMTS; + case "IS95A": return RAF_IS95A; + case "IS95B": return RAF_IS95B; + case "1XRTT": return RAF_1xRTT; + case "EVDO_0": return RAF_EVDO_0; + case "EVDO_A": return RAF_EVDO_A; + case "HSDPA": return RAF_HSDPA; + case "HSUPA": return RAF_HSUPA; + case "HSPA": return RAF_HSPA; + case "EVDO_B": return RAF_EVDO_B; + case "EHRPD": return RAF_EHRPD; + case "LTE": return RAF_LTE; + case "HSPAP": return RAF_HSPAP; + case "GSM": return RAF_GSM; + case "TD_SCDMA":return RAF_TD_SCDMA; + case "HS": return HS; + case "CDMA": return CDMA; + case "EVDO": return EVDO; + case "WCDMA": return WCDMA; + default: return RAF_UNKNOWN; + } + } + + public static int rafTypeFromString(String rafList) { + rafList = rafList.toUpperCase(); + String[] rafs = rafList.split("\\|"); + int result = 0; + for(String raf : rafs) { + int rafType = singleRafTypeFromString(raf.trim()); + if (rafType == RAF_UNKNOWN) return rafType; + result |= rafType; + } + return result; + } +} From b6ea500ef580d1967f194c51724f01e74bd94024 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Wed, 13 May 2015 15:59:29 -0700 Subject: [PATCH 10/29] DO NOT MERGE Add BIND_TELECOM_CONNECTION_SERVICE permission Bug: 21088342 Change-Id: I465307899d83c4a3ee5e88a28554c4b867c1f4ba --- api/current.txt | 1 + api/system-current.txt | 3 ++- core/res/AndroidManifest.xml | 12 +++++++++++- telecomm/java/android/telecom/ConnectionService.java | 2 +- 4 files changed, 15 insertions(+), 3 deletions(-) diff --git a/api/current.txt b/api/current.txt index 5502f8643680a..6dfdfa4840db6 100644 --- a/api/current.txt +++ b/api/current.txt @@ -29,6 +29,7 @@ package android { field public static final java.lang.String BIND_NOTIFICATION_LISTENER_SERVICE = "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"; field public static final java.lang.String BIND_PRINT_SERVICE = "android.permission.BIND_PRINT_SERVICE"; field public static final java.lang.String BIND_REMOTEVIEWS = "android.permission.BIND_REMOTEVIEWS"; + field public static final java.lang.String BIND_TELECOM_CONNECTION_SERVICE = "android.permission.BIND_TELECOM_CONNECTION_SERVICE"; field public static final java.lang.String BIND_TEXT_SERVICE = "android.permission.BIND_TEXT_SERVICE"; field public static final java.lang.String BIND_TV_INPUT = "android.permission.BIND_TV_INPUT"; field public static final java.lang.String BIND_VOICE_INTERACTION = "android.permission.BIND_VOICE_INTERACTION"; diff --git a/api/system-current.txt b/api/system-current.txt index 5d2d5e93c46ec..7a4203bf929c8 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -31,7 +31,7 @@ package android { field public static final java.lang.String BIND_CARRIER_CONFIG_SERVICE = "android.permission.BIND_CARRIER_CONFIG_SERVICE"; field public static final java.lang.String BIND_CARRIER_MESSAGING_SERVICE = "android.permission.BIND_CARRIER_MESSAGING_SERVICE"; field public static final java.lang.String BIND_CONDITION_PROVIDER_SERVICE = "android.permission.BIND_CONDITION_PROVIDER_SERVICE"; - field public static final java.lang.String BIND_CONNECTION_SERVICE = "android.permission.BIND_CONNECTION_SERVICE"; + field public static final deprecated java.lang.String BIND_CONNECTION_SERVICE = "android.permission.BIND_CONNECTION_SERVICE"; field public static final java.lang.String BIND_DEVICE_ADMIN = "android.permission.BIND_DEVICE_ADMIN"; field public static final java.lang.String BIND_DIRECTORY_SEARCH = "android.permission.BIND_DIRECTORY_SEARCH"; field public static final java.lang.String BIND_DREAM_SERVICE = "android.permission.BIND_DREAM_SERVICE"; @@ -42,6 +42,7 @@ package android { field public static final java.lang.String BIND_NOTIFICATION_LISTENER_SERVICE = "android.permission.BIND_NOTIFICATION_LISTENER_SERVICE"; field public static final java.lang.String BIND_PRINT_SERVICE = "android.permission.BIND_PRINT_SERVICE"; field public static final java.lang.String BIND_REMOTEVIEWS = "android.permission.BIND_REMOTEVIEWS"; + field public static final java.lang.String BIND_TELECOM_CONNECTION_SERVICE = "android.permission.BIND_TELECOM_CONNECTION_SERVICE"; field public static final java.lang.String BIND_TEXT_SERVICE = "android.permission.BIND_TEXT_SERVICE"; field public static final java.lang.String BIND_TRUST_AGENT = "android.permission.BIND_TRUST_AGENT"; field public static final java.lang.String BIND_TV_INPUT = "android.permission.BIND_TV_INPUT"; diff --git a/core/res/AndroidManifest.xml b/core/res/AndroidManifest.xml index 6c1c3522f0475..eee5e12f612c7 100644 --- a/core/res/AndroidManifest.xml +++ b/core/res/AndroidManifest.xml @@ -1319,7 +1319,11 @@ android:description="@string/permdesc_bind_incall_service" android:label="@string/permlab_bind_incall_service" /> - + + + + * <service android:name="com.example.package.MyConnectionService" * android:label="@string/some_label_for_my_connection_service" - * android:permission="android.permission.BIND_CONNECTION_SERVICE"> + * android:permission="android.permission.BIND_TELECOM_CONNECTION_SERVICE"> * <intent-filter> * <action android:name="android.telecom.ConnectionService" /> * </intent-filter> From 0910526fe4a1477d0b8fc7889c9d8912eebcc752 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Wed, 13 May 2015 14:14:54 -0700 Subject: [PATCH 11/29] DO NOT MERGE Rename AudioState to CallAudioState Deprecate AudioState class and make methods @SystemApi where necessary to minimize impact to SystemApi Replace usages of AudioState inside Telecom sub-systems Fire both onCallAudioStateChanged and onAudioStateChanged callbacks for backward compatibility Support both setAudioState and setCallAudioState for all classes Bug: 21040387 Bug: 21088300 Change-Id: I3ec7b3afdaa344c6d639d1c421f1842d67f7d0f7 --- api/current.txt | 49 ++-- api/system-current.txt | 47 +++- telecomm/java/android/telecom/AudioState.java | 13 +- .../java/android/telecom/CallAudioState.aidl | 22 ++ .../java/android/telecom/CallAudioState.java | 209 ++++++++++++++++++ telecomm/java/android/telecom/Conference.java | 38 +++- telecomm/java/android/telecom/Connection.java | 36 ++- .../android/telecom/ConnectionService.java | 24 +- .../java/android/telecom/InCallAdapter.java | 2 +- .../java/android/telecom/InCallService.java | 42 +++- telecomm/java/android/telecom/Phone.java | 39 +++- .../android/telecom/RemoteConference.java | 26 ++- .../android/telecom/RemoteConnection.java | 16 +- .../internal/telecom/IConnectionService.aidl | 4 +- .../internal/telecom/IInCallService.aidl | 4 +- 15 files changed, 490 insertions(+), 81 deletions(-) create mode 100644 telecomm/java/android/telecom/CallAudioState.aidl create mode 100644 telecomm/java/android/telecom/CallAudioState.java diff --git a/api/current.txt b/api/current.txt index 6dfdfa4840db6..38eb47243bc3b 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28317,23 +28317,6 @@ package android.system { package android.telecom { - public final class AudioState implements android.os.Parcelable { - ctor public AudioState(boolean, int, int); - ctor public AudioState(android.telecom.AudioState); - method public static java.lang.String audioRouteToString(int); - method public int describeContents(); - method public int getRoute(); - method public int getSupportedRouteMask(); - method public boolean isMuted(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator CREATOR; - field public static final int ROUTE_BLUETOOTH = 2; // 0x2 - field public static final int ROUTE_EARPIECE = 1; // 0x1 - field public static final int ROUTE_SPEAKER = 8; // 0x8 - field public static final int ROUTE_WIRED_HEADSET = 4; // 0x4 - field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5 - } - public final class Call { method public void answer(int); method public void conference(android.telecom.Call); @@ -28427,6 +28410,22 @@ package android.telecom { field public static final int PROPERTY_WIFI = 8; // 0x8 } + public final class CallAudioState implements android.os.Parcelable { + ctor public CallAudioState(boolean, int, int); + method public static java.lang.String audioRouteToString(int); + method public int describeContents(); + method public int getRoute(); + method public int getSupportedRouteMask(); + method public boolean isMuted(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int ROUTE_BLUETOOTH = 2; // 0x2 + field public static final int ROUTE_EARPIECE = 1; // 0x1 + field public static final int ROUTE_SPEAKER = 8; // 0x8 + field public static final int ROUTE_WIRED_HEADSET = 4; // 0x4 + field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5 + } + public final class CameraCapabilities implements android.os.Parcelable { ctor public CameraCapabilities(int, int); method public int describeContents(); @@ -28440,7 +28439,7 @@ package android.telecom { ctor public Conference(android.telecom.PhoneAccountHandle); method public final boolean addConnection(android.telecom.Connection); method public final void destroy(); - method public final android.telecom.AudioState getAudioState(); + method public final android.telecom.CallAudioState getCallAudioState(); method public final java.util.List getConferenceableConnections(); method public final long getConnectTimeMillis(); method public final int getConnectionCapabilities(); @@ -28452,7 +28451,7 @@ package android.telecom { method public final android.telecom.StatusHints getStatusHints(); method public android.telecom.Connection.VideoProvider getVideoProvider(); method public int getVideoState(); - method public void onAudioStateChanged(android.telecom.AudioState); + method public void onCallAudioStateChanged(android.telecom.CallAudioState); method public void onConnectionAdded(android.telecom.Connection); method public void onDisconnect(); method public void onHold(); @@ -28485,7 +28484,7 @@ package android.telecom { method public final android.net.Uri getAddress(); method public final int getAddressPresentation(); method public final boolean getAudioModeIsVoip(); - method public final android.telecom.AudioState getAudioState(); + method public final android.telecom.CallAudioState getCallAudioState(); method public final java.lang.String getCallerDisplayName(); method public final int getCallerDisplayNamePresentation(); method public final android.telecom.Conference getConference(); @@ -28499,7 +28498,7 @@ package android.telecom { method public void onAbort(); method public void onAnswer(int); method public void onAnswer(); - method public void onAudioStateChanged(android.telecom.AudioState); + method public void onCallAudioStateChanged(android.telecom.CallAudioState); method public void onDisconnect(); method public void onHold(); method public void onPlayDtmfTone(char); @@ -28659,12 +28658,12 @@ package android.telecom { public abstract class InCallService extends android.app.Service { ctor public InCallService(); method public final boolean canAddCall(); - method public final android.telecom.AudioState getAudioState(); + method public final android.telecom.CallAudioState getCallAudioState(); method public final java.util.List getCalls(); - method public void onAudioStateChanged(android.telecom.AudioState); method public android.os.IBinder onBind(android.content.Intent); method public void onBringToForeground(boolean); method public void onCallAdded(android.telecom.Call); + method public void onCallAudioStateChanged(android.telecom.CallAudioState); method public void onCallRemoved(android.telecom.Call); method public void onCanAddCallChanged(boolean); method public final void setAudioRoute(int); @@ -28776,7 +28775,7 @@ package android.telecom { method public final void registerCallback(android.telecom.RemoteConference.Callback); method public final void registerCallback(android.telecom.RemoteConference.Callback, android.os.Handler); method public void separate(android.telecom.RemoteConnection); - method public void setAudioState(android.telecom.AudioState); + method public void setCallAudioState(android.telecom.CallAudioState); method public void stopDtmfTone(); method public void swap(); method public void unhold(); @@ -28816,7 +28815,7 @@ package android.telecom { method public void registerCallback(android.telecom.RemoteConnection.Callback); method public void registerCallback(android.telecom.RemoteConnection.Callback, android.os.Handler); method public void reject(); - method public void setAudioState(android.telecom.AudioState); + method public void setCallAudioState(android.telecom.CallAudioState); method public void stopDtmfTone(); method public void unhold(); method public void unregisterCallback(android.telecom.RemoteConnection.Callback); diff --git a/api/system-current.txt b/api/system-current.txt index 7a4203bf929c8..05521545f751c 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30132,9 +30132,10 @@ package android.system { package android.telecom { - public final class AudioState implements android.os.Parcelable { + public deprecated class AudioState implements android.os.Parcelable { ctor public AudioState(boolean, int, int); ctor public AudioState(android.telecom.AudioState); + ctor public AudioState(android.telecom.CallAudioState); method public static java.lang.String audioRouteToString(int); method public int describeContents(); method public int getRoute(); @@ -30249,6 +30250,22 @@ package android.telecom { ctor public Call.Listener(); } + public final class CallAudioState implements android.os.Parcelable { + ctor public CallAudioState(boolean, int, int); + method public static java.lang.String audioRouteToString(int); + method public int describeContents(); + method public int getRoute(); + method public int getSupportedRouteMask(); + method public boolean isMuted(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + field public static final int ROUTE_BLUETOOTH = 2; // 0x2 + field public static final int ROUTE_EARPIECE = 1; // 0x1 + field public static final int ROUTE_SPEAKER = 8; // 0x8 + field public static final int ROUTE_WIRED_HEADSET = 4; // 0x4 + field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5 + } + public final class CameraCapabilities implements android.os.Parcelable { ctor public CameraCapabilities(int, int); method public int describeContents(); @@ -30262,7 +30279,8 @@ package android.telecom { ctor public Conference(android.telecom.PhoneAccountHandle); method public final boolean addConnection(android.telecom.Connection); method public final void destroy(); - method public final android.telecom.AudioState getAudioState(); + method public final deprecated android.telecom.AudioState getAudioState(); + method public final android.telecom.CallAudioState getCallAudioState(); method public final java.util.List getConferenceableConnections(); method public final long getConnectTimeMillis(); method public final int getConnectionCapabilities(); @@ -30274,7 +30292,8 @@ package android.telecom { method public final android.telecom.StatusHints getStatusHints(); method public android.telecom.Connection.VideoProvider getVideoProvider(); method public int getVideoState(); - method public void onAudioStateChanged(android.telecom.AudioState); + method public deprecated void onAudioStateChanged(android.telecom.AudioState); + method public void onCallAudioStateChanged(android.telecom.CallAudioState); method public void onConnectionAdded(android.telecom.Connection); method public void onDisconnect(); method public void onHold(); @@ -30307,7 +30326,8 @@ package android.telecom { method public final android.net.Uri getAddress(); method public final int getAddressPresentation(); method public final boolean getAudioModeIsVoip(); - method public final android.telecom.AudioState getAudioState(); + method public final deprecated android.telecom.AudioState getAudioState(); + method public final android.telecom.CallAudioState getCallAudioState(); method public final java.lang.String getCallerDisplayName(); method public final int getCallerDisplayNamePresentation(); method public final android.telecom.Conference getConference(); @@ -30321,7 +30341,8 @@ package android.telecom { method public void onAbort(); method public void onAnswer(int); method public void onAnswer(); - method public void onAudioStateChanged(android.telecom.AudioState); + method public deprecated void onAudioStateChanged(android.telecom.AudioState); + method public void onCallAudioStateChanged(android.telecom.CallAudioState); method public void onDisconnect(); method public void onHold(); method public void onPlayDtmfTone(char); @@ -30481,13 +30502,13 @@ package android.telecom { public abstract class InCallService extends android.app.Service { ctor public InCallService(); method public final boolean canAddCall(); - method public final android.telecom.AudioState getAudioState(); + method public final android.telecom.CallAudioState getCallAudioState(); method public final java.util.List getCalls(); method public deprecated android.telecom.Phone getPhone(); - method public void onAudioStateChanged(android.telecom.AudioState); method public android.os.IBinder onBind(android.content.Intent); method public void onBringToForeground(boolean); method public void onCallAdded(android.telecom.Call); + method public void onCallAudioStateChanged(android.telecom.CallAudioState); method public void onCallRemoved(android.telecom.Call); method public void onCanAddCallChanged(boolean); method public deprecated void onPhoneCreated(android.telecom.Phone); @@ -30528,7 +30549,8 @@ package android.telecom { public final deprecated class Phone { method public final void addListener(android.telecom.Phone.Listener); method public final boolean canAddCall(); - method public final android.telecom.AudioState getAudioState(); + method public final deprecated android.telecom.AudioState getAudioState(); + method public final android.telecom.CallAudioState getCallAudioState(); method public final java.util.List getCalls(); method public final void removeListener(android.telecom.Phone.Listener); method public final void setAudioRoute(int); @@ -30537,9 +30559,10 @@ package android.telecom { public static abstract class Phone.Listener { ctor public Phone.Listener(); - method public void onAudioStateChanged(android.telecom.Phone, android.telecom.AudioState); + method public deprecated void onAudioStateChanged(android.telecom.Phone, android.telecom.AudioState); method public void onBringToForeground(android.telecom.Phone, boolean); method public void onCallAdded(android.telecom.Phone, android.telecom.Call); + method public void onCallAudioStateChanged(android.telecom.Phone, android.telecom.CallAudioState); method public void onCallRemoved(android.telecom.Phone, android.telecom.Call); method public void onCanAddCallChanged(android.telecom.Phone, boolean); } @@ -30621,7 +30644,8 @@ package android.telecom { method public final void registerCallback(android.telecom.RemoteConference.Callback); method public final void registerCallback(android.telecom.RemoteConference.Callback, android.os.Handler); method public void separate(android.telecom.RemoteConnection); - method public void setAudioState(android.telecom.AudioState); + method public deprecated void setAudioState(android.telecom.AudioState); + method public void setCallAudioState(android.telecom.CallAudioState); method public void stopDtmfTone(); method public void swap(); method public void unhold(); @@ -30661,7 +30685,8 @@ package android.telecom { method public void registerCallback(android.telecom.RemoteConnection.Callback); method public void registerCallback(android.telecom.RemoteConnection.Callback, android.os.Handler); method public void reject(); - method public void setAudioState(android.telecom.AudioState); + method public deprecated void setAudioState(android.telecom.AudioState); + method public void setCallAudioState(android.telecom.CallAudioState); method public void stopDtmfTone(); method public void unhold(); method public void unregisterCallback(android.telecom.RemoteConnection.Callback); diff --git a/telecomm/java/android/telecom/AudioState.java b/telecomm/java/android/telecom/AudioState.java index 465c5f41a2977..33013ac07a3c3 100644 --- a/telecomm/java/android/telecom/AudioState.java +++ b/telecomm/java/android/telecom/AudioState.java @@ -16,6 +16,7 @@ package android.telecom; +import android.annotation.SystemApi; import android.os.Parcel; import android.os.Parcelable; @@ -24,8 +25,12 @@ import java.util.Locale; /** * Encapsulates the telecom audio state, including the current audio routing, supported audio * routing and mute. + * @deprecated - use {@link CallAudioState} instead. + * @hide */ -public final class AudioState implements Parcelable { +@Deprecated +@SystemApi +public class AudioState implements Parcelable { /** Direct the audio stream through the device's earpiece. */ public static final int ROUTE_EARPIECE = 0x00000001; @@ -64,6 +69,12 @@ public final class AudioState implements Parcelable { supportedRouteMask = state.getSupportedRouteMask(); } + public AudioState(CallAudioState state) { + isMuted = state.isMuted(); + route = state.getRoute(); + supportedRouteMask = state.getSupportedRouteMask(); + } + @Override public boolean equals(Object obj) { if (obj == null) { diff --git a/telecomm/java/android/telecom/CallAudioState.aidl b/telecomm/java/android/telecom/CallAudioState.aidl new file mode 100644 index 0000000000000..90dbbe5c1bb34 --- /dev/null +++ b/telecomm/java/android/telecom/CallAudioState.aidl @@ -0,0 +1,22 @@ +/* + * Copyright 2014, 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. + */ + +package android.telecom; + +/** + * {@hide} + */ +parcelable CallAudioState; diff --git a/telecomm/java/android/telecom/CallAudioState.java b/telecomm/java/android/telecom/CallAudioState.java new file mode 100644 index 0000000000000..2b1672209a3df --- /dev/null +++ b/telecomm/java/android/telecom/CallAudioState.java @@ -0,0 +1,209 @@ +/* + * Copyright (C) 2014 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. + */ + +package android.telecom; + +import android.os.Parcel; +import android.os.Parcelable; + +import java.util.Locale; + +/** + * Encapsulates the telecom audio state, including the current audio routing, supported audio + * routing and mute. + */ +public final class CallAudioState implements Parcelable { + /** Direct the audio stream through the device's earpiece. */ + public static final int ROUTE_EARPIECE = 0x00000001; + + /** Direct the audio stream through Bluetooth. */ + public static final int ROUTE_BLUETOOTH = 0x00000002; + + /** Direct the audio stream through a wired headset. */ + public static final int ROUTE_WIRED_HEADSET = 0x00000004; + + /** Direct the audio stream through the device's speakerphone. */ + public static final int ROUTE_SPEAKER = 0x00000008; + + /** + * Direct the audio stream through the device's earpiece or wired headset if one is + * connected. + */ + public static final int ROUTE_WIRED_OR_EARPIECE = ROUTE_EARPIECE | ROUTE_WIRED_HEADSET; + + /** Bit mask of all possible audio routes. */ + private static final int ROUTE_ALL = ROUTE_EARPIECE | ROUTE_BLUETOOTH | ROUTE_WIRED_HEADSET | + ROUTE_SPEAKER; + + private final boolean isMuted; + private final int route; + private final int supportedRouteMask; + + /** + * Constructor for a {@link CallAudioState} object. + * + * @param muted {@code true} if the call is muted, {@code false} otherwise. + * @param route The current audio route being used. + * Allowed values: + * {@link #ROUTE_EARPIECE} + * {@link #ROUTE_BLUETOOTH} + * {@link #ROUTE_WIRED_HEADSET} + * {@link #ROUTE_SPEAKER} + * @param supportedRouteMask Bit mask of all routes supported by this call. This should be a + * bitwise combination of the following values: + * {@link #ROUTE_EARPIECE} + * {@link #ROUTE_BLUETOOTH} + * {@link #ROUTE_WIRED_HEADSET} + * {@link #ROUTE_SPEAKER} + */ + public CallAudioState(boolean muted, int route, int supportedRouteMask) { + this.isMuted = muted; + this.route = route; + this.supportedRouteMask = supportedRouteMask; + } + + /** @hide */ + public CallAudioState(CallAudioState state) { + isMuted = state.isMuted(); + route = state.getRoute(); + supportedRouteMask = state.getSupportedRouteMask(); + } + + /** @hide */ + @SuppressWarnings("deprecation") + public CallAudioState(AudioState state) { + isMuted = state.isMuted(); + route = state.getRoute(); + supportedRouteMask = state.getSupportedRouteMask(); + } + + @Override + public boolean equals(Object obj) { + if (obj == null) { + return false; + } + if (!(obj instanceof CallAudioState)) { + return false; + } + CallAudioState state = (CallAudioState) obj; + return isMuted() == state.isMuted() && getRoute() == state.getRoute() && + getSupportedRouteMask() == state.getSupportedRouteMask(); + } + + @Override + public String toString() { + return String.format(Locale.US, + "[AudioState isMuted: %b, route: %s, supportedRouteMask: %s]", + isMuted, + audioRouteToString(route), + audioRouteToString(supportedRouteMask)); + } + + /** + * @return {@code true} if the call is muted, {@code false} otherwise. + */ + public boolean isMuted() { + return isMuted; + } + + /** + * @return The current audio route being used. + */ + public int getRoute() { + return route; + } + + /** + * @return Bit mask of all routes supported by this call. + */ + public int getSupportedRouteMask() { + return supportedRouteMask; + } + + /** + * Converts the provided audio route into a human readable string representation. + * + * @param route to convert into a string. + * + * @return String representation of the provided audio route. + */ + public static String audioRouteToString(int route) { + if (route == 0 || (route & ~ROUTE_ALL) != 0x0) { + return "UNKNOWN"; + } + + StringBuffer buffer = new StringBuffer(); + if ((route & ROUTE_EARPIECE) == ROUTE_EARPIECE) { + listAppend(buffer, "EARPIECE"); + } + if ((route & ROUTE_BLUETOOTH) == ROUTE_BLUETOOTH) { + listAppend(buffer, "BLUETOOTH"); + } + if ((route & ROUTE_WIRED_HEADSET) == ROUTE_WIRED_HEADSET) { + listAppend(buffer, "WIRED_HEADSET"); + } + if ((route & ROUTE_SPEAKER) == ROUTE_SPEAKER) { + listAppend(buffer, "SPEAKER"); + } + + return buffer.toString(); + } + + /** + * Responsible for creating AudioState objects for deserialized Parcels. + */ + public static final Parcelable.Creator CREATOR = + new Parcelable.Creator () { + + @Override + public CallAudioState createFromParcel(Parcel source) { + boolean isMuted = source.readByte() == 0 ? false : true; + int route = source.readInt(); + int supportedRouteMask = source.readInt(); + return new CallAudioState(isMuted, route, supportedRouteMask); + } + + @Override + public CallAudioState[] newArray(int size) { + return new CallAudioState[size]; + } + }; + + /** + * {@inheritDoc} + */ + @Override + public int describeContents() { + return 0; + } + + /** + * Writes AudioState object into a serializeable Parcel. + */ + @Override + public void writeToParcel(Parcel destination, int flags) { + destination.writeByte((byte) (isMuted ? 1 : 0)); + destination.writeInt(route); + destination.writeInt(supportedRouteMask); + } + + private static void listAppend(StringBuffer buffer, String str) { + if (buffer.length() > 0) { + buffer.append(", "); + } + buffer.append(str); + } +} diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index eb0ae9e01fde5..2bb27cbabcfbf 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -16,6 +16,7 @@ package android.telecom; +import android.annotation.SystemApi; import android.telecom.Connection.VideoProvider; import java.util.ArrayList; @@ -62,7 +63,7 @@ public abstract class Conference implements IConferenceable { Collections.unmodifiableList(mConferenceableConnections); private PhoneAccountHandle mPhoneAccount; - private AudioState mAudioState; + private CallAudioState mCallAudioState; private int mState = Connection.STATE_NEW; private DisconnectCause mDisconnectCause; private int mConnectionCapabilities; @@ -172,9 +173,22 @@ public abstract class Conference implements IConferenceable { * @return The audio state of the conference, describing how its audio is currently * being routed by the system. This is {@code null} if this Conference * does not directly know about its audio state. + * @deprecated Use {@link #getCallAudioState()} instead. + * @hide */ + @Deprecated + @SystemApi public final AudioState getAudioState() { - return mAudioState; + return new AudioState(mCallAudioState); + } + + /** + * @return The audio state of the conference, describing how its audio is currently + * being routed by the system. This is {@code null} if this Conference + * does not directly know about its audio state. + */ + public final CallAudioState getCallAudioState() { + return mCallAudioState; } /** @@ -248,9 +262,20 @@ public abstract class Conference implements IConferenceable { * Notifies this conference that the {@link #getAudioState()} property has a new value. * * @param state The new call audio state. + * @deprecated Use {@link #onCallAudioStateChanged(CallAudioState)} instead. + * @hide */ + @SystemApi + @Deprecated public void onAudioStateChanged(AudioState state) {} + /** + * Notifies this conference that the {@link #getCallAudioState()} property has a new value. + * + * @param state The new call audio state. + */ + public void onCallAudioStateChanged(CallAudioState state) {} + /** * Notifies this conference that a connection has been added to it. * @@ -492,10 +517,11 @@ public abstract class Conference implements IConferenceable { * @param state The new audio state. * @hide */ - final void setAudioState(AudioState state) { - Log.d(this, "setAudioState %s", state); - mAudioState = state; - onAudioStateChanged(state); + final void setCallAudioState(CallAudioState state) { + Log.d(this, "setCallAudioState %s", state); + mCallAudioState = state; + onAudioStateChanged(getAudioState()); + onCallAudioStateChanged(state); } private void setState(int newState) { diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index baddfa2825e33..162cfbec0be92 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -20,6 +20,7 @@ import com.android.internal.os.SomeArgs; import com.android.internal.telecom.IVideoCallback; import com.android.internal.telecom.IVideoProvider; +import android.annotation.SystemApi; import android.net.Uri; import android.os.Handler; import android.os.IBinder; @@ -800,7 +801,7 @@ public abstract class Connection implements IConferenceable { Collections.unmodifiableList(mConferenceables); private int mState = STATE_NEW; - private AudioState mAudioState; + private CallAudioState mCallAudioState; private Uri mAddress; private int mAddressPresentation; private String mCallerDisplayName; @@ -875,9 +876,22 @@ public abstract class Connection implements IConferenceable { * @return The audio state of the connection, describing how its audio is currently * being routed by the system. This is {@code null} if this Connection * does not directly know about its audio state. + * @deprecated Use {@link #getCallAudioState()} instead. + * @hide */ + @SystemApi + @Deprecated public final AudioState getAudioState() { - return mAudioState; + return new AudioState(mCallAudioState); + } + + /** + * @return The audio state of the connection, describing how its audio is currently + * being routed by the system. This is {@code null} if this Connection + * does not directly know about its audio state. + */ + public final CallAudioState getCallAudioState() { + return mCallAudioState; } /** @@ -951,11 +965,12 @@ public abstract class Connection implements IConferenceable { * @param state The new audio state. * @hide */ - final void setAudioState(AudioState state) { + final void setCallAudioState(CallAudioState state) { checkImmutable(); Log.d(this, "setAudioState %s", state); - mAudioState = state; - onAudioStateChanged(state); + mCallAudioState = state; + onAudioStateChanged(getAudioState()); + onCallAudioStateChanged(state); } /** @@ -1345,9 +1360,20 @@ public abstract class Connection implements IConferenceable { * Notifies this Connection that the {@link #getAudioState()} property has a new value. * * @param state The new connection audio state. + * @deprecated Use {@link #onCallAudioStateChanged(CallAudioState)} instead. + * @hide */ + @SystemApi + @Deprecated public void onAudioStateChanged(AudioState state) {} + /** + * Notifies this Connection that the {@link #getCallAudioState()} property has a new value. + * + * @param state The new connection audio state. + */ + public void onCallAudioStateChanged(CallAudioState state) {} + /** * Notifies this Connection of an internal state change. This method is called after the * state is changed. diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 0614192f02409..5715dff7460b7 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -90,7 +90,7 @@ public abstract class ConnectionService extends Service { private static final int MSG_DISCONNECT = 6; private static final int MSG_HOLD = 7; private static final int MSG_UNHOLD = 8; - private static final int MSG_ON_AUDIO_STATE_CHANGED = 9; + private static final int MSG_ON_CALL_AUDIO_STATE_CHANGED = 9; private static final int MSG_PLAY_DTMF_TONE = 10; private static final int MSG_STOP_DTMF_TONE = 11; private static final int MSG_CONFERENCE = 12; @@ -180,11 +180,11 @@ public abstract class ConnectionService extends Service { } @Override - public void onAudioStateChanged(String callId, AudioState audioState) { + public void onCallAudioStateChanged(String callId, CallAudioState callAudioState) { SomeArgs args = SomeArgs.obtain(); args.arg1 = callId; - args.arg2 = audioState; - mHandler.obtainMessage(MSG_ON_AUDIO_STATE_CHANGED, args).sendToTarget(); + args.arg2 = callAudioState; + mHandler.obtainMessage(MSG_ON_CALL_AUDIO_STATE_CHANGED, args).sendToTarget(); } @Override @@ -304,12 +304,12 @@ public abstract class ConnectionService extends Service { case MSG_UNHOLD: unhold((String) msg.obj); break; - case MSG_ON_AUDIO_STATE_CHANGED: { + case MSG_ON_CALL_AUDIO_STATE_CHANGED: { SomeArgs args = (SomeArgs) msg.obj; try { String callId = (String) args.arg1; - AudioState audioState = (AudioState) args.arg2; - onAudioStateChanged(callId, audioState); + CallAudioState audioState = (CallAudioState) args.arg2; + onCallAudioStateChanged(callId, new CallAudioState(audioState)); } finally { args.recycle(); } @@ -688,12 +688,14 @@ public abstract class ConnectionService extends Service { } } - private void onAudioStateChanged(String callId, AudioState audioState) { - Log.d(this, "onAudioStateChanged %s %s", callId, audioState); + private void onCallAudioStateChanged(String callId, CallAudioState callAudioState) { + Log.d(this, "onAudioStateChanged %s %s", callId, callAudioState); if (mConnectionById.containsKey(callId)) { - findConnectionForAction(callId, "onAudioStateChanged").setAudioState(audioState); + findConnectionForAction(callId, "onCallAudioStateChanged").setCallAudioState( + callAudioState); } else { - findConferenceForAction(callId, "onAudioStateChanged").setAudioState(audioState); + findConferenceForAction(callId, "onCallAudioStateChanged").setCallAudioState( + callAudioState); } } diff --git a/telecomm/java/android/telecom/InCallAdapter.java b/telecomm/java/android/telecom/InCallAdapter.java index 62b8dea946b49..0cf7212ba55be 100644 --- a/telecomm/java/android/telecom/InCallAdapter.java +++ b/telecomm/java/android/telecom/InCallAdapter.java @@ -119,7 +119,7 @@ public final class InCallAdapter { } /** - * Sets the audio route (speaker, bluetooth, etc...). See {@link AudioState}. + * Sets the audio route (speaker, bluetooth, etc...). See {@link CallAudioState}. * * @param route The audio route to use. */ diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java index 5392298b0b60e..6645e64f8c7ee 100644 --- a/telecomm/java/android/telecom/InCallService.java +++ b/telecomm/java/android/telecom/InCallService.java @@ -51,7 +51,7 @@ public abstract class InCallService extends Service { private static final int MSG_ADD_CALL = 2; private static final int MSG_UPDATE_CALL = 3; private static final int MSG_SET_POST_DIAL_WAIT = 4; - private static final int MSG_ON_AUDIO_STATE_CHANGED = 5; + private static final int MSG_ON_CALL_AUDIO_STATE_CHANGED = 5; private static final int MSG_BRING_TO_FOREGROUND = 6; private static final int MSG_ON_CAN_ADD_CALL_CHANGED = 7; @@ -86,8 +86,8 @@ public abstract class InCallService extends Service { } break; } - case MSG_ON_AUDIO_STATE_CHANGED: - mPhone.internalAudioStateChanged((AudioState) msg.obj); + case MSG_ON_CALL_AUDIO_STATE_CHANGED: + mPhone.internalCallAudioStateChanged((CallAudioState) msg.obj); break; case MSG_BRING_TO_FOREGROUND: mPhone.internalBringToForeground(msg.arg1 == 1); @@ -132,8 +132,8 @@ public abstract class InCallService extends Service { } @Override - public void onAudioStateChanged(AudioState audioState) { - mHandler.obtainMessage(MSG_ON_AUDIO_STATE_CHANGED, audioState).sendToTarget(); + public void onCallAudioStateChanged(CallAudioState callAudioState) { + mHandler.obtainMessage(MSG_ON_CALL_AUDIO_STATE_CHANGED, callAudioState).sendToTarget(); } @Override @@ -155,6 +155,10 @@ public abstract class InCallService extends Service { InCallService.this.onAudioStateChanged(audioState); } + public void onCallAudioStateChanged(Phone phone, CallAudioState callAudioState) { + InCallService.this.onCallAudioStateChanged(callAudioState); + }; + /** ${inheritDoc} */ @Override public void onBringToForeground(Phone phone, boolean showDialpad) { @@ -247,14 +251,27 @@ public abstract class InCallService extends Service { * * @return An object encapsulating the audio state. Returns null if the service is not * fully initialized. + * @deprecated Use {@link #getCallAudioState()} instead. + * @hide */ + @Deprecated public final AudioState getAudioState() { return mPhone == null ? null : mPhone.getAudioState(); } + /** + * Obtains the current phone call audio state. + * + * @return An object encapsulating the audio state. Returns null if the service is not + * fully initialized. + */ + public final CallAudioState getCallAudioState() { + return mPhone == null ? null : mPhone.getCallAudioState(); + } + /** * Sets the microphone mute state. When this request is honored, there will be change to - * the {@link #getAudioState()}. + * the {@link #getCallAudioState()}. * * @param state {@code true} if the microphone should be muted; {@code false} otherwise. */ @@ -266,7 +283,7 @@ public abstract class InCallService extends Service { /** * Sets the audio route (speaker, bluetooth, etc...). When this request is honored, there will - * be change to the {@link #getAudioState()}. + * be change to the {@link #getCallAudioState()}. * * @param route The audio route to use. */ @@ -310,10 +327,21 @@ public abstract class InCallService extends Service { * Called when the audio state changes. * * @param audioState The new {@link AudioState}. + * @deprecated Use {@link #onCallAudioStateChanged(CallAudioState) instead}. + * @hide */ + @Deprecated public void onAudioStateChanged(AudioState audioState) { } + /** + * Called when the audio state changes. + * + * @param audioState The new {@link CallAudioState}. + */ + public void onCallAudioStateChanged(CallAudioState audioState) { + } + /** * Called to bring the in-call screen to the foreground. The in-call experience should * respond immediately by coming to the foreground to inform the user of the state of diff --git a/telecomm/java/android/telecom/Phone.java b/telecomm/java/android/telecom/Phone.java index 4cdfd2eb8f561..8eb091b732af2 100644 --- a/telecomm/java/android/telecom/Phone.java +++ b/telecomm/java/android/telecom/Phone.java @@ -41,9 +41,20 @@ public final class Phone { * * @param phone The {@code Phone} calling this method. * @param audioState The new {@link AudioState}. + * + * @deprecated Use {@link #onCallAudioStateChanged(Phone, CallAudioState)} instead. */ + @Deprecated public void onAudioStateChanged(Phone phone, AudioState audioState) { } + /** + * Called when the audio state changes. + * + * @param phone The {@code Phone} calling this method. + * @param callAudioState The new {@link CallAudioState}. + */ + public void onCallAudioStateChanged(Phone phone, CallAudioState callAudioState) { } + /** * Called to bring the in-call screen to the foreground. The in-call experience should * respond immediately by coming to the foreground to inform the user of the state of @@ -100,7 +111,7 @@ public final class Phone { private final InCallAdapter mInCallAdapter; - private AudioState mAudioState; + private CallAudioState mCallAudioState; private final List mListeners = new CopyOnWriteArrayList<>(); @@ -145,10 +156,10 @@ public final class Phone { } } - final void internalAudioStateChanged(AudioState audioState) { - if (!Objects.equals(mAudioState, audioState)) { - mAudioState = audioState; - fireAudioStateChanged(audioState); + final void internalCallAudioStateChanged(CallAudioState callAudioState) { + if (!Objects.equals(mCallAudioState, callAudioState)) { + mCallAudioState = callAudioState; + fireCallAudioStateChanged(callAudioState); } } @@ -271,9 +282,20 @@ public final class Phone { * Obtains the current phone call audio state of the {@code Phone}. * * @return An object encapsulating the audio state. + * @deprecated Use {@link #getCallAudioState()} instead. */ + @Deprecated public final AudioState getAudioState() { - return mAudioState; + return new AudioState(mCallAudioState); + } + + /** + * Obtains the current phone call audio state of the {@code Phone}. + * + * @return An object encapsulating the audio state. + */ + public final CallAudioState getCallAudioState() { + return mCallAudioState; } private void fireCallAdded(Call call) { @@ -288,9 +310,10 @@ public final class Phone { } } - private void fireAudioStateChanged(AudioState audioState) { + private void fireCallAudioStateChanged(CallAudioState audioState) { for (Listener listener : mListeners) { - listener.onAudioStateChanged(this, audioState); + listener.onCallAudioStateChanged(this, audioState); + listener.onAudioStateChanged(this, new AudioState(audioState)); } } diff --git a/telecomm/java/android/telecom/RemoteConference.java b/telecomm/java/android/telecom/RemoteConference.java index a76bf5998a514..7a0ee117b8d31 100644 --- a/telecomm/java/android/telecom/RemoteConference.java +++ b/telecomm/java/android/telecom/RemoteConference.java @@ -18,6 +18,7 @@ package android.telecom; import com.android.internal.telecom.IConnectionService; +import android.annotation.SystemApi; import android.os.Handler; import android.os.RemoteException; @@ -279,13 +280,36 @@ public final class RemoteConference { } } + /** + * Request to change the conference's audio routing to the specified state. The specified state + * can include audio routing (Bluetooth, Speaker, etc) and muting state. + * + * @see android.telecom.AudioState + * @deprecated Use {@link #setCallAudioState(CallAudioState)} instead. + * @hide + */ + @SystemApi + @Deprecated public void setAudioState(AudioState state) { + setCallAudioState(new CallAudioState(state)); + } + + /** + * Request to change the conference's audio routing to the specified state. The specified state + * can include audio routing (Bluetooth, Speaker, etc) and muting state. + */ + public void setCallAudioState(CallAudioState state) { try { - mConnectionService.onAudioStateChanged(mId, state); + mConnectionService.onCallAudioStateChanged(mId, state); } catch (RemoteException e) { } } + /** + * Returns a list of independent connections that can me merged with this conference. + * + * @return A list of conferenceable connections. + */ public List getConferenceableConnections() { return mUnmodifiableConferenceableConnections; } diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index 9ca9f316cd35e..b7f1dd1e49aa6 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -20,6 +20,7 @@ import com.android.internal.telecom.IConnectionService; import com.android.internal.telecom.IVideoCallback; import com.android.internal.telecom.IVideoProvider; +import android.annotation.SystemApi; import android.net.Uri; import android.os.Handler; import android.os.IBinder; @@ -775,11 +776,24 @@ public final class RemoteConnection { * Set the audio state of this {@code RemoteConnection}. * * @param state The audio state of this {@code RemoteConnection}. + * @hide + * @deprecated Use {@link #setCallAudioState(CallAudioState) instead. */ + @SystemApi + @Deprecated public void setAudioState(AudioState state) { + setCallAudioState(new CallAudioState(state)); + } + + /** + * Set the audio state of this {@code RemoteConnection}. + * + * @param state The audio state of this {@code RemoteConnection}. + */ + public void setCallAudioState(CallAudioState state) { try { if (mConnected) { - mConnectionService.onAudioStateChanged(mConnectionId, state); + mConnectionService.onCallAudioStateChanged(mConnectionId, state); } } catch (RemoteException ignored) { } diff --git a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl index 339a9829ed15f..c2e8530b2dbd3 100644 --- a/telecomm/java/com/android/internal/telecom/IConnectionService.aidl +++ b/telecomm/java/com/android/internal/telecom/IConnectionService.aidl @@ -17,7 +17,7 @@ package com.android.internal.telecom; import android.os.Bundle; -import android.telecom.AudioState; +import android.telecom.CallAudioState; import android.telecom.ConnectionRequest; import android.telecom.PhoneAccountHandle; @@ -56,7 +56,7 @@ oneway interface IConnectionService { void unhold(String callId); - void onAudioStateChanged(String activeCallId, in AudioState audioState); + void onCallAudioStateChanged(String activeCallId, in CallAudioState callAudioState); void playDtmfTone(String callId, char digit); diff --git a/telecomm/java/com/android/internal/telecom/IInCallService.aidl b/telecomm/java/com/android/internal/telecom/IInCallService.aidl index d26f6cb427baf..ded47d5a0562d 100644 --- a/telecomm/java/com/android/internal/telecom/IInCallService.aidl +++ b/telecomm/java/com/android/internal/telecom/IInCallService.aidl @@ -17,7 +17,7 @@ package com.android.internal.telecom; import android.app.PendingIntent; -import android.telecom.AudioState; +import android.telecom.CallAudioState; import android.telecom.ParcelableCall; import com.android.internal.telecom.IInCallAdapter; @@ -40,7 +40,7 @@ oneway interface IInCallService { void setPostDialWait(String callId, String remaining); - void onAudioStateChanged(in AudioState audioState); + void onCallAudioStateChanged(in CallAudioState callAudioState); void bringToForeground(boolean showDialpad); From 6d3a7575e102e44514c1f834bd497f6b26e96769 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Tue, 12 May 2015 16:18:03 -0700 Subject: [PATCH 12/29] DO NOT MERGE More video related API fixes android.telecom.Connection.VideoProvider * onSetPauseImage takes Uri instead of String * changeCallDataUsage -> setCallDataUsage * add quality constants to changeVideoQuality() docs android.telecom.InCallService.VideoCall * setPauseImage takes Uri instea dof String android.telecom.VideoProfile.VideoState * Move constants to VideoProfile, prefix with STATE_ Bug: 21040387 Bug: 21066505 Change-Id: I764e72aced9d1e2d30d6d0cf0862100860d47c79 --- api/current.txt | 17 ++--- api/system-current.txt | 17 ++--- telecomm/java/android/telecom/Call.java | 2 +- telecomm/java/android/telecom/Conference.java | 8 +- telecomm/java/android/telecom/Connection.java | 43 +++++++---- .../android/telecom/ConnectionRequest.java | 8 +- .../java/android/telecom/InCallService.java | 3 +- .../android/telecom/RemoteConnection.java | 2 +- .../java/android/telecom/TelecomManager.java | 8 +- .../java/android/telecom/VideoCallImpl.java | 3 +- .../java/android/telecom/VideoProfile.java | 74 ++++++++++++++----- .../internal/telecom/IVideoProvider.aidl | 3 +- .../ims/internal/IImsVideoCallProvider.aidl | 3 +- 13 files changed, 125 insertions(+), 66 deletions(-) diff --git a/api/current.txt b/api/current.txt index 38eb47243bc3b..dd696664df199 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28556,7 +28556,6 @@ package android.telecom { public static abstract class Connection.VideoProvider { ctor public Connection.VideoProvider(); - method public void changeCallDataUsage(long); method public void changeCameraCapabilities(android.telecom.CameraCapabilities); method public void changePeerDimensions(int, int); method public void changeVideoQuality(int); @@ -28568,11 +28567,12 @@ package android.telecom { method public abstract void onSetCamera(java.lang.String); method public abstract void onSetDeviceOrientation(int); method public abstract void onSetDisplaySurface(android.view.Surface); - method public abstract void onSetPauseImage(java.lang.String); + method public abstract void onSetPauseImage(android.net.Uri); method public abstract void onSetPreviewSurface(android.view.Surface); method public abstract void onSetZoom(float); method public void receiveSessionModifyRequest(android.telecom.VideoProfile); method public void receiveSessionModifyResponse(int, android.telecom.VideoProfile, android.telecom.VideoProfile); + method public void setCallDataUsage(long); field public static final int SESSION_EVENT_CAMERA_FAILURE = 5; // 0x5 field public static final int SESSION_EVENT_CAMERA_READY = 6; // 0x6 field public static final int SESSION_EVENT_RX_PAUSE = 1; // 0x1 @@ -28682,7 +28682,7 @@ package android.telecom { method public abstract void setCamera(java.lang.String); method public abstract void setDeviceOrientation(int); method public abstract void setDisplaySurface(android.view.Surface); - method public abstract void setPauseImage(java.lang.String); + method public abstract void setPauseImage(android.net.Uri); method public abstract void setPreviewSurface(android.view.Surface); method public abstract void setZoom(float); method public abstract void unregisterCallback(android.telecom.InCallService.VideoCall.Callback); @@ -28901,21 +28901,20 @@ package android.telecom { field public static final int QUALITY_HIGH = 1; // 0x1 field public static final int QUALITY_LOW = 3; // 0x3 field public static final int QUALITY_MEDIUM = 2; // 0x2 + field public static final int STATE_AUDIO_ONLY = 0; // 0x0 + field public static final int STATE_BIDIRECTIONAL = 3; // 0x3 + field public static final int STATE_PAUSED = 4; // 0x4 + field public static final int STATE_RX_ENABLED = 2; // 0x2 + field public static final int STATE_TX_ENABLED = 1; // 0x1 } public static class VideoProfile.VideoState { - ctor public VideoProfile.VideoState(); method public static boolean isAudioOnly(int); method public static boolean isBidirectional(int); method public static boolean isPaused(int); method public static boolean isReceptionEnabled(int); method public static boolean isTransmissionEnabled(int); method public static java.lang.String videoStateToString(int); - field public static final int AUDIO_ONLY = 0; // 0x0 - field public static final int BIDIRECTIONAL = 3; // 0x3 - field public static final int PAUSED = 4; // 0x4 - field public static final int RX_ENABLED = 2; // 0x2 - field public static final int TX_ENABLED = 1; // 0x1 } } diff --git a/api/system-current.txt b/api/system-current.txt index 05521545f751c..a8fd2776e53d9 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30400,7 +30400,6 @@ package android.telecom { public static abstract class Connection.VideoProvider { ctor public Connection.VideoProvider(); - method public void changeCallDataUsage(long); method public void changeCameraCapabilities(android.telecom.CameraCapabilities); method public void changePeerDimensions(int, int); method public void changeVideoQuality(int); @@ -30412,11 +30411,12 @@ package android.telecom { method public abstract void onSetCamera(java.lang.String); method public abstract void onSetDeviceOrientation(int); method public abstract void onSetDisplaySurface(android.view.Surface); - method public abstract void onSetPauseImage(java.lang.String); + method public abstract void onSetPauseImage(android.net.Uri); method public abstract void onSetPreviewSurface(android.view.Surface); method public abstract void onSetZoom(float); method public void receiveSessionModifyRequest(android.telecom.VideoProfile); method public void receiveSessionModifyResponse(int, android.telecom.VideoProfile, android.telecom.VideoProfile); + method public void setCallDataUsage(long); field public static final int SESSION_EVENT_CAMERA_FAILURE = 5; // 0x5 field public static final int SESSION_EVENT_CAMERA_READY = 6; // 0x6 field public static final int SESSION_EVENT_RX_PAUSE = 1; // 0x1 @@ -30529,7 +30529,7 @@ package android.telecom { method public abstract void setCamera(java.lang.String); method public abstract void setDeviceOrientation(int); method public abstract void setDisplaySurface(android.view.Surface); - method public abstract void setPauseImage(java.lang.String); + method public abstract void setPauseImage(android.net.Uri); method public abstract void setPreviewSurface(android.view.Surface); method public abstract void setZoom(float); method public abstract void unregisterCallback(android.telecom.InCallService.VideoCall.Callback); @@ -30791,21 +30791,20 @@ package android.telecom { field public static final int QUALITY_HIGH = 1; // 0x1 field public static final int QUALITY_LOW = 3; // 0x3 field public static final int QUALITY_MEDIUM = 2; // 0x2 + field public static final int STATE_AUDIO_ONLY = 0; // 0x0 + field public static final int STATE_BIDIRECTIONAL = 3; // 0x3 + field public static final int STATE_PAUSED = 4; // 0x4 + field public static final int STATE_RX_ENABLED = 2; // 0x2 + field public static final int STATE_TX_ENABLED = 1; // 0x1 } public static class VideoProfile.VideoState { - ctor public VideoProfile.VideoState(); method public static boolean isAudioOnly(int); method public static boolean isBidirectional(int); method public static boolean isPaused(int); method public static boolean isReceptionEnabled(int); method public static boolean isTransmissionEnabled(int); method public static java.lang.String videoStateToString(int); - field public static final int AUDIO_ONLY = 0; // 0x0 - field public static final int BIDIRECTIONAL = 3; // 0x3 - field public static final int PAUSED = 4; // 0x4 - field public static final int RX_ENABLED = 2; // 0x2 - field public static final int TX_ENABLED = 1; // 0x1 } } diff --git a/telecomm/java/android/telecom/Call.java b/telecomm/java/android/telecom/Call.java index adab00bb1e25e..d74c61c7c34a7 100644 --- a/telecomm/java/android/telecom/Call.java +++ b/telecomm/java/android/telecom/Call.java @@ -202,7 +202,7 @@ public final class Call { /** * For video calls, indicates whether the outgoing video for the call can be paused using - * the {@link android.telecom.VideoProfile.VideoState#PAUSED} VideoState. + * the {@link android.telecom.VideoProfile#STATE_PAUSED} VideoState. */ public static final int CAPABILITY_CAN_PAUSE_VIDEO = 0x00100000; diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index 2bb27cbabcfbf..0da755fe8a783 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -390,10 +390,10 @@ public abstract class Conference implements IConferenceable { /** * Set the video state for the conference. - * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, - * {@link VideoProfile.VideoState#BIDIRECTIONAL}, - * {@link VideoProfile.VideoState#TX_ENABLED}, - * {@link VideoProfile.VideoState#RX_ENABLED}. + * Valid values: {@link VideoProfile#STATE_AUDIO_ONLY}, + * {@link VideoProfile#STATE_BIDIRECTIONAL}, + * {@link VideoProfile#STATE_TX_ENABLED}, + * {@link VideoProfile#STATE_RX_ENABLED}. * * @param videoState The new video state. */ diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 162cfbec0be92..93b48b175d43b 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -187,7 +187,7 @@ public abstract class Connection implements IConferenceable { /** * For video calls, indicates whether the outgoing video for the call can be paused using - * the {@link android.telecom.VideoProfile.VideoState#PAUSED} VideoState. + * the {@link android.telecom.VideoProfile#STATE_PAUSED} VideoState. */ public static final int CAPABILITY_CAN_PAUSE_VIDEO = 0x00100000; @@ -485,7 +485,7 @@ public abstract class Connection implements IConferenceable { onRequestConnectionDataUsage(); break; case MSG_SET_PAUSE_IMAGE: - onSetPauseImage((String) msg.obj); + onSetPauseImage((Uri) msg.obj); break; default: break; @@ -548,7 +548,7 @@ public abstract class Connection implements IConferenceable { mMessageHandler.obtainMessage(MSG_REQUEST_CONNECTION_DATA_USAGE).sendToTarget(); } - public void setPauseImage(String uri) { + public void setPauseImage(Uri uri) { mMessageHandler.obtainMessage(MSG_SET_PAUSE_IMAGE, uri).sendToTarget(); } } @@ -643,7 +643,7 @@ public abstract class Connection implements IConferenceable { * * @param uri URI of image to display. */ - public abstract void onSetPauseImage(String uri); + public abstract void onSetPauseImage(Uri uri); /** * Invokes callback method defined in listening {@link InCallService} implementations. @@ -727,7 +727,7 @@ public abstract class Connection implements IConferenceable { * * @param dataUsage The updated data usage. */ - public void changeCallDataUsage(long dataUsage) { + public void setCallDataUsage(long dataUsage) { if (mVideoCallbacks != null) { try { for (IVideoCallback callback : mVideoCallbacks.values()) { @@ -738,6 +738,17 @@ public abstract class Connection implements IConferenceable { } } + /** + * Invokes callback method defined in listening {@link InCallService} implementations. + * + * @param dataUsage The updated data usage. + * @deprecated - Use {@link #setCallDataUsage(long)} instead. + * @hide + */ + public void changeCallDataUsage(long dataUsage) { + setCallDataUsage(dataUsage); + } + /** * Invokes callback method defined in listening {@link InCallService} implementations. * @@ -757,6 +768,12 @@ public abstract class Connection implements IConferenceable { /** * Invokes callback method defined in listening {@link InCallService} implementations. * + * Allowed values: + * {@link VideoProfile#QUALITY_HIGH}, + * {@link VideoProfile#QUALITY_MEDIUM}, + * {@link VideoProfile#QUALITY_LOW}, + * {@link VideoProfile#QUALITY_DEFAULT}. + * * @param videoQuality The updated video quality. */ public void changeVideoQuality(int videoQuality) { @@ -860,10 +877,10 @@ public abstract class Connection implements IConferenceable { /** * Returns the video state of the connection. - * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, - * {@link VideoProfile.VideoState#BIDIRECTIONAL}, - * {@link VideoProfile.VideoState#TX_ENABLED}, - * {@link VideoProfile.VideoState#RX_ENABLED}. + * Valid values: {@link VideoProfile#STATE_AUDIO_ONLY}, + * {@link VideoProfile#STATE_BIDIRECTIONAL}, + * {@link VideoProfile#STATE_TX_ENABLED}, + * {@link VideoProfile#STATE_RX_ENABLED}. * * @return The video state of the connection. * @hide @@ -1042,10 +1059,10 @@ public abstract class Connection implements IConferenceable { /** * Set the video state for the connection. - * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, - * {@link VideoProfile.VideoState#BIDIRECTIONAL}, - * {@link VideoProfile.VideoState#TX_ENABLED}, - * {@link VideoProfile.VideoState#RX_ENABLED}. + * Valid values: {@link VideoProfile#STATE_AUDIO_ONLY}, + * {@link VideoProfile#STATE_BIDIRECTIONAL}, + * {@link VideoProfile#STATE_TX_ENABLED}, + * {@link VideoProfile#STATE_RX_ENABLED}. * * @param videoState The new video state. */ diff --git a/telecomm/java/android/telecom/ConnectionRequest.java b/telecomm/java/android/telecom/ConnectionRequest.java index f5cceea80060e..975df5d40aa6a 100644 --- a/telecomm/java/android/telecom/ConnectionRequest.java +++ b/telecomm/java/android/telecom/ConnectionRequest.java @@ -88,10 +88,10 @@ public final class ConnectionRequest implements Parcelable { /** * Describes the video states supported by the client requesting the connection. - * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, - * {@link VideoProfile.VideoState#BIDIRECTIONAL}, - * {@link VideoProfile.VideoState#TX_ENABLED}, - * {@link VideoProfile.VideoState#RX_ENABLED}. + * Valid values: {@link VideoProfile#STATE_AUDIO_ONLY}, + * {@link VideoProfile#STATE_BIDIRECTIONAL}, + * {@link VideoProfile#STATE_TX_ENABLED}, + * {@link VideoProfile#STATE_RX_ENABLED}. * * @return The video state for the connection. */ diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java index 6645e64f8c7ee..5703ea57e3dad 100644 --- a/telecomm/java/android/telecom/InCallService.java +++ b/telecomm/java/android/telecom/InCallService.java @@ -20,6 +20,7 @@ import android.annotation.SdkConstant; import android.annotation.SystemApi; import android.app.Service; import android.content.Intent; +import android.net.Uri; import android.os.Handler; import android.os.IBinder; import android.os.Looper; @@ -494,7 +495,7 @@ public abstract class InCallService extends Service { * * @param uri URI of image to display. */ - public abstract void setPauseImage(String uri); + public abstract void setPauseImage(Uri uri); /** * Callback class which invokes callbacks after video call actions occur. diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index b7f1dd1e49aa6..e0eb563650ab5 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -379,7 +379,7 @@ public final class RemoteConnection { } } - public void setPauseImage(String uri) { + public void setPauseImage(Uri uri) { try { mVideoProviderBinder.setPauseImage(uri); } catch (RemoteException e) { diff --git a/telecomm/java/android/telecom/TelecomManager.java b/telecomm/java/android/telecom/TelecomManager.java index 2ea84bec08eb4..a46b0bbfdd074 100644 --- a/telecomm/java/android/telecom/TelecomManager.java +++ b/telecomm/java/android/telecom/TelecomManager.java @@ -107,10 +107,10 @@ public class TelecomManager { * Optional extra for {@link android.content.Intent#ACTION_CALL} containing an integer that * determines the desired video state for an outgoing call. * Valid options: - * {@link VideoProfile.VideoState#AUDIO_ONLY}, - * {@link VideoProfile.VideoState#BIDIRECTIONAL}, - * {@link VideoProfile.VideoState#RX_ENABLED}, - * {@link VideoProfile.VideoState#TX_ENABLED}. + * {@link VideoProfile#STATE_AUDIO_ONLY}, + * {@link VideoProfile#STATE_BIDIRECTIONAL}, + * {@link VideoProfile#STATE_RX_ENABLED}, + * {@link VideoProfile#STATE_TX_ENABLED}. */ public static final String EXTRA_START_CALL_WITH_VIDEO_STATE = "android.telecom.extra.START_CALL_WITH_VIDEO_STATE"; diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java index 0af098f7957e4..61341cd1ed252 100644 --- a/telecomm/java/android/telecom/VideoCallImpl.java +++ b/telecomm/java/android/telecom/VideoCallImpl.java @@ -16,6 +16,7 @@ package android.telecom; +import android.net.Uri; import android.os.Handler; import android.os.IBinder; import android.os.Looper; @@ -303,7 +304,7 @@ public class VideoCallImpl extends VideoCall { } /** {@inheritDoc} */ - public void setPauseImage(String uri) { + public void setPauseImage(Uri uri) { try { mVideoProvider.setPauseImage(uri); } catch (RemoteException e) { diff --git a/telecomm/java/android/telecom/VideoProfile.java b/telecomm/java/android/telecom/VideoProfile.java index 902fddb22a6c8..363daf9b3bcf9 100644 --- a/telecomm/java/android/telecom/VideoProfile.java +++ b/telecomm/java/android/telecom/VideoProfile.java @@ -48,6 +48,31 @@ public class VideoProfile implements Parcelable { */ public static final int QUALITY_DEFAULT = 4; + /** + * Call is currently in an audio-only mode with no video transmission or receipt. + */ + public static final int STATE_AUDIO_ONLY = 0x0; + + /** + * Video transmission is enabled. + */ + public static final int STATE_TX_ENABLED = 0x1; + + /** + * Video reception is enabled. + */ + public static final int STATE_RX_ENABLED = 0x2; + + /** + * Video signal is bi-directional. + */ + public static final int STATE_BIDIRECTIONAL = STATE_TX_ENABLED | STATE_RX_ENABLED; + + /** + * Video is paused. + */ + public static final int STATE_PAUSED = 0x4; + private final int mVideoState; private final int mQuality; @@ -74,11 +99,11 @@ public class VideoProfile implements Parcelable { /** * The video state of the call. - * Valid values: {@link VideoProfile.VideoState#AUDIO_ONLY}, - * {@link VideoProfile.VideoState#BIDIRECTIONAL}, - * {@link VideoProfile.VideoState#TX_ENABLED}, - * {@link VideoProfile.VideoState#RX_ENABLED}, - * {@link VideoProfile.VideoState#PAUSED}. + * Valid values: {@link VideoProfile#STATE_AUDIO_ONLY}, + * {@link VideoProfile#STATE_BIDIRECTIONAL}, + * {@link VideoProfile#STATE_TX_ENABLED}, + * {@link VideoProfile#STATE_RX_ENABLED}, + * {@link VideoProfile#STATE_PAUSED}. */ public int getVideoState() { return mVideoState; @@ -162,28 +187,41 @@ public class VideoProfile implements Parcelable { public static class VideoState { /** * Call is currently in an audio-only mode with no video transmission or receipt. + * @deprecated Use {@link VideoProfile#STATE_AUDIO_ONLY} instead + * @hide */ - public static final int AUDIO_ONLY = 0x0; + public static final int AUDIO_ONLY = VideoProfile.STATE_AUDIO_ONLY; /** * Video transmission is enabled. + * @deprecated Use {@link VideoProfile#STATE_TX_ENABLED} instead + * @hide */ - public static final int TX_ENABLED = 0x1; + public static final int TX_ENABLED = VideoProfile.STATE_TX_ENABLED; /** * Video reception is enabled. + * @deprecated Use {@link VideoProfile#STATE_RX_ENABLED} instead + * @hide */ - public static final int RX_ENABLED = 0x2; + public static final int RX_ENABLED = VideoProfile.STATE_RX_ENABLED; /** * Video signal is bi-directional. + * @deprecated Use {@link VideoProfile#STATE_BIDIRECTIONAL} instead + * @hide */ - public static final int BIDIRECTIONAL = TX_ENABLED | RX_ENABLED; + public static final int BIDIRECTIONAL = VideoProfile.STATE_BIDIRECTIONAL; /** * Video is paused. + * @deprecated Use {@link VideoProfile#STATE_PAUSED} instead + * @hide */ - public static final int PAUSED = 0x4; + public static final int PAUSED = VideoProfile.STATE_PAUSED; + + /** @hide */ + private VideoState() {} /** * Whether the video state is audio only. @@ -191,7 +229,8 @@ public class VideoProfile implements Parcelable { * @return Returns true if the video state is audio only. */ public static boolean isAudioOnly(int videoState) { - return !hasState(videoState, TX_ENABLED) && !hasState(videoState, RX_ENABLED); + return !hasState(videoState, VideoProfile.STATE_TX_ENABLED) + && !hasState(videoState, VideoProfile.STATE_RX_ENABLED); } /** @@ -201,8 +240,9 @@ public class VideoProfile implements Parcelable { * @return Returns true if the video state TX or RX or Bidirectional */ public static boolean isVideo(int videoState) { - return hasState(videoState, TX_ENABLED) || hasState(videoState, RX_ENABLED) - || hasState(videoState, BIDIRECTIONAL); + return hasState(videoState, VideoProfile.STATE_TX_ENABLED) + || hasState(videoState, VideoProfile.STATE_RX_ENABLED) + || hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); } /** @@ -211,7 +251,7 @@ public class VideoProfile implements Parcelable { * @return Returns true if the video transmission is enabled. */ public static boolean isTransmissionEnabled(int videoState) { - return hasState(videoState, TX_ENABLED); + return hasState(videoState, VideoProfile.STATE_TX_ENABLED); } /** @@ -220,7 +260,7 @@ public class VideoProfile implements Parcelable { * @return Returns true if the video transmission is enabled. */ public static boolean isReceptionEnabled(int videoState) { - return hasState(videoState, RX_ENABLED); + return hasState(videoState, VideoProfile.STATE_RX_ENABLED); } /** @@ -229,7 +269,7 @@ public class VideoProfile implements Parcelable { * @return Returns true if the video signal is bi-directional. */ public static boolean isBidirectional(int videoState) { - return hasState(videoState, BIDIRECTIONAL); + return hasState(videoState, VideoProfile.STATE_BIDIRECTIONAL); } /** @@ -238,7 +278,7 @@ public class VideoProfile implements Parcelable { * @return Returns true if the video is paused. */ public static boolean isPaused(int videoState) { - return hasState(videoState, PAUSED); + return hasState(videoState, VideoProfile.STATE_PAUSED); } /** diff --git a/telecomm/java/com/android/internal/telecom/IVideoProvider.aidl b/telecomm/java/com/android/internal/telecom/IVideoProvider.aidl index d095744b6b345..68e5fd48e1aca 100644 --- a/telecomm/java/com/android/internal/telecom/IVideoProvider.aidl +++ b/telecomm/java/com/android/internal/telecom/IVideoProvider.aidl @@ -16,6 +16,7 @@ package com.android.internal.telecom; +import android.net.Uri; import android.view.Surface; import android.telecom.VideoProfile; @@ -47,5 +48,5 @@ oneway interface IVideoProvider { void requestCallDataUsage(); - void setPauseImage(String uri); + void setPauseImage(in Uri uri); } diff --git a/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl b/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl index 4ff0b4367ea56..39e83c66b9bbe 100644 --- a/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl +++ b/telephony/java/com/android/ims/internal/IImsVideoCallProvider.aidl @@ -16,6 +16,7 @@ package com.android.ims.internal; +import android.net.Uri; import android.view.Surface; import android.telecom.VideoProfile; @@ -60,5 +61,5 @@ oneway interface IImsVideoCallProvider { void requestCallDataUsage(); - void setPauseImage(String uri); + void setPauseImage(in Uri uri); } From 56acbc410093b9854060c3a32c68a60d95cdca85 Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Tue, 12 May 2015 13:31:25 -0700 Subject: [PATCH 13/29] DO NOT MERGE Fixes for APi review Move CameraCapabilities into VideoProfile Make PhoneAccount and PhoneAccountHandle final Bug: 21040387 Bug: 21066505 Change-Id: I72453c89ae3765f9b9cf263938fce96d5978d2e0 --- api/current.txt | 26 +-- api/system-current.txt | 26 +-- .../android/telecom/CameraCapabilities.aidl | 22 --- .../android/telecom/CameraCapabilities.java | 157 ------------------ telecomm/java/android/telecom/Connection.java | 2 +- .../java/android/telecom/InCallService.java | 3 +- .../java/android/telecom/PhoneAccount.java | 2 +- .../android/telecom/PhoneAccountHandle.java | 2 +- .../android/telecom/RemoteConnection.java | 5 +- .../java/android/telecom/VideoCallImpl.java | 4 +- .../android/telecom/VideoCallbackServant.java | 5 +- .../java/android/telecom/VideoProfile.aidl | 1 + .../java/android/telecom/VideoProfile.java | 138 +++++++++++++++ .../internal/telecom/IVideoCallback.aidl | 3 +- .../ims/internal/IImsVideoCallCallback.aidl | 3 +- 15 files changed, 180 insertions(+), 219 deletions(-) delete mode 100644 telecomm/java/android/telecom/CameraCapabilities.aidl delete mode 100644 telecomm/java/android/telecom/CameraCapabilities.java diff --git a/api/current.txt b/api/current.txt index dd696664df199..657b806dcb2a8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28426,15 +28426,6 @@ package android.telecom { field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5 } - public final class CameraCapabilities implements android.os.Parcelable { - ctor public CameraCapabilities(int, int); - method public int describeContents(); - method public int getHeight(); - method public int getWidth(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator CREATOR; - } - public abstract class Conference implements android.telecom.IConferenceable { ctor public Conference(android.telecom.PhoneAccountHandle); method public final boolean addConnection(android.telecom.Connection); @@ -28556,7 +28547,7 @@ package android.telecom { public static abstract class Connection.VideoProvider { ctor public Connection.VideoProvider(); - method public void changeCameraCapabilities(android.telecom.CameraCapabilities); + method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities); method public void changePeerDimensions(int, int); method public void changeVideoQuality(int); method public void handleCallSessionEvent(int); @@ -28692,14 +28683,14 @@ package android.telecom { ctor public InCallService.VideoCall.Callback(); method public abstract void onCallDataUsageChanged(long); method public abstract void onCallSessionEvent(int); - method public abstract void onCameraCapabilitiesChanged(android.telecom.CameraCapabilities); + method public abstract void onCameraCapabilitiesChanged(android.telecom.VideoProfile.CameraCapabilities); method public abstract void onPeerDimensionsChanged(int, int); method public abstract void onSessionModifyRequestReceived(android.telecom.VideoProfile); method public abstract void onSessionModifyResponseReceived(int, android.telecom.VideoProfile, android.telecom.VideoProfile); method public abstract void onVideoQualityChanged(int); } - public class PhoneAccount implements android.os.Parcelable { + public final class PhoneAccount implements android.os.Parcelable { method public static android.telecom.PhoneAccount.Builder builder(android.telecom.PhoneAccountHandle, java.lang.CharSequence); method public android.graphics.drawable.Drawable createIconDrawable(android.content.Context); method public int describeContents(); @@ -28751,7 +28742,7 @@ package android.telecom { method public android.telecom.PhoneAccount.Builder setSupportedUriSchemes(java.util.List); } - public class PhoneAccountHandle implements android.os.Parcelable { + public final class PhoneAccountHandle implements android.os.Parcelable { ctor public PhoneAccountHandle(android.content.ComponentName, java.lang.String); ctor public PhoneAccountHandle(android.content.ComponentName, java.lang.String, android.os.UserHandle); method public int describeContents(); @@ -28908,6 +28899,15 @@ package android.telecom { field public static final int STATE_TX_ENABLED = 1; // 0x1 } + public static final class VideoProfile.CameraCapabilities implements android.os.Parcelable { + ctor public VideoProfile.CameraCapabilities(int, int); + method public int describeContents(); + method public int getHeight(); + method public int getWidth(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + public static class VideoProfile.VideoState { method public static boolean isAudioOnly(int); method public static boolean isBidirectional(int); diff --git a/api/system-current.txt b/api/system-current.txt index a8fd2776e53d9..3cd8abb0aca1f 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30266,15 +30266,6 @@ package android.telecom { field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5 } - public final class CameraCapabilities implements android.os.Parcelable { - ctor public CameraCapabilities(int, int); - method public int describeContents(); - method public int getHeight(); - method public int getWidth(); - method public void writeToParcel(android.os.Parcel, int); - field public static final android.os.Parcelable.Creator CREATOR; - } - public abstract class Conference implements android.telecom.IConferenceable { ctor public Conference(android.telecom.PhoneAccountHandle); method public final boolean addConnection(android.telecom.Connection); @@ -30400,7 +30391,7 @@ package android.telecom { public static abstract class Connection.VideoProvider { ctor public Connection.VideoProvider(); - method public void changeCameraCapabilities(android.telecom.CameraCapabilities); + method public void changeCameraCapabilities(android.telecom.VideoProfile.CameraCapabilities); method public void changePeerDimensions(int, int); method public void changeVideoQuality(int); method public void handleCallSessionEvent(int); @@ -30539,7 +30530,7 @@ package android.telecom { ctor public InCallService.VideoCall.Callback(); method public abstract void onCallDataUsageChanged(long); method public abstract void onCallSessionEvent(int); - method public abstract void onCameraCapabilitiesChanged(android.telecom.CameraCapabilities); + method public abstract void onCameraCapabilitiesChanged(android.telecom.VideoProfile.CameraCapabilities); method public abstract void onPeerDimensionsChanged(int, int); method public abstract void onSessionModifyRequestReceived(android.telecom.VideoProfile); method public abstract void onSessionModifyResponseReceived(int, android.telecom.VideoProfile, android.telecom.VideoProfile); @@ -30567,7 +30558,7 @@ package android.telecom { method public void onCanAddCallChanged(android.telecom.Phone, boolean); } - public class PhoneAccount implements android.os.Parcelable { + public final class PhoneAccount implements android.os.Parcelable { method public static android.telecom.PhoneAccount.Builder builder(android.telecom.PhoneAccountHandle, java.lang.CharSequence); method public android.graphics.drawable.Drawable createIconDrawable(android.content.Context); method public int describeContents(); @@ -30620,7 +30611,7 @@ package android.telecom { method public android.telecom.PhoneAccount.Builder setSupportedUriSchemes(java.util.List); } - public class PhoneAccountHandle implements android.os.Parcelable { + public final class PhoneAccountHandle implements android.os.Parcelable { ctor public PhoneAccountHandle(android.content.ComponentName, java.lang.String); ctor public PhoneAccountHandle(android.content.ComponentName, java.lang.String, android.os.UserHandle); method public int describeContents(); @@ -30798,6 +30789,15 @@ package android.telecom { field public static final int STATE_TX_ENABLED = 1; // 0x1 } + public static final class VideoProfile.CameraCapabilities implements android.os.Parcelable { + ctor public VideoProfile.CameraCapabilities(int, int); + method public int describeContents(); + method public int getHeight(); + method public int getWidth(); + method public void writeToParcel(android.os.Parcel, int); + field public static final android.os.Parcelable.Creator CREATOR; + } + public static class VideoProfile.VideoState { method public static boolean isAudioOnly(int); method public static boolean isBidirectional(int); diff --git a/telecomm/java/android/telecom/CameraCapabilities.aidl b/telecomm/java/android/telecom/CameraCapabilities.aidl deleted file mode 100644 index c8e0c5e896a57..0000000000000 --- a/telecomm/java/android/telecom/CameraCapabilities.aidl +++ /dev/null @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2014 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 - */ - -package android.telecom; - -/** - * {@hide} - */ -parcelable CameraCapabilities; diff --git a/telecomm/java/android/telecom/CameraCapabilities.java b/telecomm/java/android/telecom/CameraCapabilities.java deleted file mode 100644 index 62429569c71ef..0000000000000 --- a/telecomm/java/android/telecom/CameraCapabilities.java +++ /dev/null @@ -1,157 +0,0 @@ -/* - * Copyright (C) 2014 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 - */ - -package android.telecom; - -import android.os.Parcel; -import android.os.Parcelable; - -/** - * Represents the camera capabilities important to a Video Telephony provider. - */ -public final class CameraCapabilities implements Parcelable { - - /** - * The width of the camera video in pixels. - */ - private final int mWidth; - - /** - * The height of the camera video in pixels. - */ - private final int mHeight; - - /** - * Whether the camera supports zoom. - */ - private final boolean mZoomSupported; - - /** - * The maximum zoom supported by the camera. - */ - private final float mMaxZoom; - - /** - * Create a call camera capabilities instance. - * - * @param width The width of the camera video (in pixels). - * @param height The height of the camera video (in pixels). - */ - public CameraCapabilities(int width, int height) { - this(width, height, false, 1.0f); - } - - /** - * Create a call camera capabilities instance that optionally - * supports zoom. - * - * @param width The width of the camera video (in pixels). - * @param height The height of the camera video (in pixels). - * @param zoomSupported True when camera supports zoom. - * @param maxZoom Maximum zoom supported by camera. - * @hide - */ - public CameraCapabilities(int width, int height, boolean zoomSupported, float maxZoom) { - mWidth = width; - mHeight = height; - mZoomSupported = zoomSupported; - mMaxZoom = maxZoom; - } - - /** - * Responsible for creating CallCameraCapabilities objects from deserialized Parcels. - **/ - public static final Parcelable.Creator CREATOR = - new Parcelable.Creator () { - /** - * Creates a CallCameraCapabilities instances from a parcel. - * - * @param source The parcel. - * @return The CallCameraCapabilities. - */ - @Override - public CameraCapabilities createFromParcel(Parcel source) { - int width = source.readInt(); - int height = source.readInt(); - boolean supportsZoom = source.readByte() != 0; - float maxZoom = source.readFloat(); - - return new CameraCapabilities(width, height, supportsZoom, maxZoom); - } - - @Override - public CameraCapabilities[] newArray(int size) { - return new CameraCapabilities[size]; - } - }; - - /** - * Describe the kinds of special objects contained in this Parcelable's - * marshalled representation. - * - * @return a bitmask indicating the set of special object types marshalled - * by the Parcelable. - */ - @Override - public int describeContents() { - return 0; - } - - /** - * Flatten this object in to a Parcel. - * - * @param dest The Parcel in which the object should be written. - * @param flags Additional flags about how the object should be written. - * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}. - */ - @Override - public void writeToParcel(Parcel dest, int flags) { - dest.writeInt(getWidth()); - dest.writeInt(getHeight()); - dest.writeByte((byte) (isZoomSupported() ? 1 : 0)); - dest.writeFloat(getMaxZoom()); - } - - /** - * The width of the camera video in pixels. - */ - public int getWidth() { - return mWidth; - } - - /** - * The height of the camera video in pixels. - */ - public int getHeight() { - return mHeight; - } - - /** - * Whether the camera supports zoom. - * @hide - */ - public boolean isZoomSupported() { - return mZoomSupported; - } - - /** - * The maximum zoom supported by the camera. - * @hide - */ - public float getMaxZoom() { - return mMaxZoom; - } -} diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 93b48b175d43b..6b555dce90d16 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -754,7 +754,7 @@ public abstract class Connection implements IConferenceable { * * @param cameraCapabilities The changed camera capabilities. */ - public void changeCameraCapabilities(CameraCapabilities cameraCapabilities) { + public void changeCameraCapabilities(VideoProfile.CameraCapabilities cameraCapabilities) { if (mVideoCallbacks != null) { try { for (IVideoCallback callback : mVideoCallbacks.values()) { diff --git a/telecomm/java/android/telecom/InCallService.java b/telecomm/java/android/telecom/InCallService.java index 5703ea57e3dad..960e8f37ba1f5 100644 --- a/telecomm/java/android/telecom/InCallService.java +++ b/telecomm/java/android/telecom/InCallService.java @@ -575,7 +575,8 @@ public abstract class InCallService extends Service { * * @param cameraCapabilities The changed camera capabilities. */ - public abstract void onCameraCapabilitiesChanged(CameraCapabilities cameraCapabilities); + public abstract void onCameraCapabilitiesChanged( + VideoProfile.CameraCapabilities cameraCapabilities); } } } diff --git a/telecomm/java/android/telecom/PhoneAccount.java b/telecomm/java/android/telecom/PhoneAccount.java index bab460dfb71e8..86475b1cea1ca 100644 --- a/telecomm/java/android/telecom/PhoneAccount.java +++ b/telecomm/java/android/telecom/PhoneAccount.java @@ -47,7 +47,7 @@ import java.util.MissingResourceException; * should supply a valid {@link PhoneAccountHandle} that references the connection service * implementation Telecom will use to interact with the app. */ -public class PhoneAccount implements Parcelable { +public final class PhoneAccount implements Parcelable { /** * Flag indicating that this {@code PhoneAccount} can act as a connection manager for diff --git a/telecomm/java/android/telecom/PhoneAccountHandle.java b/telecomm/java/android/telecom/PhoneAccountHandle.java index 60917b2dc568e..6dc6e9cfd1222 100644 --- a/telecomm/java/android/telecom/PhoneAccountHandle.java +++ b/telecomm/java/android/telecom/PhoneAccountHandle.java @@ -35,7 +35,7 @@ import java.util.Objects; * * See {@link PhoneAccount}, {@link TelecomManager}. */ -public class PhoneAccountHandle implements Parcelable { +public final class PhoneAccountHandle implements Parcelable { private final ComponentName mComponentName; private final String mId; private final UserHandle mUserHandle; diff --git a/telecomm/java/android/telecom/RemoteConnection.java b/telecomm/java/android/telecom/RemoteConnection.java index e0eb563650ab5..08485a30277b3 100644 --- a/telecomm/java/android/telecom/RemoteConnection.java +++ b/telecomm/java/android/telecom/RemoteConnection.java @@ -221,7 +221,7 @@ public final class RemoteConnection { public void onCameraCapabilitiesChanged( VideoProvider videoProvider, - CameraCapabilities cameraCapabilities) {} + VideoProfile.CameraCapabilities cameraCapabilities) {} public void onVideoQualityChanged(VideoProvider videoProvider, int videoQuality) {} } @@ -268,7 +268,8 @@ public final class RemoteConnection { } @Override - public void changeCameraCapabilities(CameraCapabilities cameraCapabilities) { + public void changeCameraCapabilities( + VideoProfile.CameraCapabilities cameraCapabilities) { for (Listener l : mListeners) { l.onCameraCapabilitiesChanged(VideoProvider.this, cameraCapabilities); } diff --git a/telecomm/java/android/telecom/VideoCallImpl.java b/telecomm/java/android/telecom/VideoCallImpl.java index 61341cd1ed252..3d77f9b63cd72 100644 --- a/telecomm/java/android/telecom/VideoCallImpl.java +++ b/telecomm/java/android/telecom/VideoCallImpl.java @@ -99,7 +99,7 @@ public class VideoCallImpl extends VideoCall { } @Override - public void changeCameraCapabilities(CameraCapabilities cameraCapabilities) { + public void changeCameraCapabilities(VideoProfile.CameraCapabilities cameraCapabilities) { mHandler.obtainMessage(MessageHandler.MSG_CHANGE_CAMERA_CAPABILITIES, cameraCapabilities).sendToTarget(); } @@ -161,7 +161,7 @@ public class VideoCallImpl extends VideoCall { break; case MSG_CHANGE_CAMERA_CAPABILITIES: mCallback.onCameraCapabilitiesChanged( - (CameraCapabilities) msg.obj); + (VideoProfile.CameraCapabilities) msg.obj); break; case MSG_CHANGE_VIDEO_QUALITY: mVideoQuality = msg.arg1; diff --git a/telecomm/java/android/telecom/VideoCallbackServant.java b/telecomm/java/android/telecom/VideoCallbackServant.java index 1123621ac005e..1fbad22447da2 100644 --- a/telecomm/java/android/telecom/VideoCallbackServant.java +++ b/telecomm/java/android/telecom/VideoCallbackServant.java @@ -98,7 +98,7 @@ final class VideoCallbackServant { break; } case MSG_CHANGE_CAMERA_CAPABILITIES: { - mDelegate.changeCameraCapabilities((CameraCapabilities) msg.obj); + mDelegate.changeCameraCapabilities((VideoProfile.CameraCapabilities) msg.obj); break; } case MSG_CHANGE_VIDEO_QUALITY: { @@ -148,7 +148,8 @@ final class VideoCallbackServant { } @Override - public void changeCameraCapabilities(CameraCapabilities cameraCapabilities) + public void changeCameraCapabilities( + VideoProfile.CameraCapabilities cameraCapabilities) throws RemoteException { mHandler.obtainMessage(MSG_CHANGE_CAMERA_CAPABILITIES, cameraCapabilities) .sendToTarget(); diff --git a/telecomm/java/android/telecom/VideoProfile.aidl b/telecomm/java/android/telecom/VideoProfile.aidl index 091b5697aba2f..0b3272172b320 100644 --- a/telecomm/java/android/telecom/VideoProfile.aidl +++ b/telecomm/java/android/telecom/VideoProfile.aidl @@ -21,3 +21,4 @@ package android.telecom; * {@hide} */ parcelable VideoProfile; +parcelable VideoProfile.CameraCapabilities; diff --git a/telecomm/java/android/telecom/VideoProfile.java b/telecomm/java/android/telecom/VideoProfile.java index 363daf9b3bcf9..71de505879d49 100644 --- a/telecomm/java/android/telecom/VideoProfile.java +++ b/telecomm/java/android/telecom/VideoProfile.java @@ -318,4 +318,142 @@ public class VideoProfile implements Parcelable { return sb.toString(); } } + + /** + * Represents the camera capabilities important to a Video Telephony provider. + */ + public static final class CameraCapabilities implements Parcelable { + + /** + * The width of the camera video in pixels. + */ + private final int mWidth; + + /** + * The height of the camera video in pixels. + */ + private final int mHeight; + + /** + * Whether the camera supports zoom. + */ + private final boolean mZoomSupported; + + /** + * The maximum zoom supported by the camera. + */ + private final float mMaxZoom; + + /** + * Create a call camera capabilities instance. + * + * @param width The width of the camera video (in pixels). + * @param height The height of the camera video (in pixels). + */ + public CameraCapabilities(int width, int height) { + this(width, height, false, 1.0f); + } + + /** + * Create a call camera capabilities instance that optionally + * supports zoom. + * + * @param width The width of the camera video (in pixels). + * @param height The height of the camera video (in pixels). + * @param zoomSupported True when camera supports zoom. + * @param maxZoom Maximum zoom supported by camera. + * @hide + */ + public CameraCapabilities(int width, int height, boolean zoomSupported, float maxZoom) { + mWidth = width; + mHeight = height; + mZoomSupported = zoomSupported; + mMaxZoom = maxZoom; + } + + /** + * Responsible for creating CallCameraCapabilities objects from deserialized Parcels. + **/ + public static final Parcelable.Creator CREATOR = + new Parcelable.Creator () { + /** + * Creates a CallCameraCapabilities instances from a parcel. + * + * @param source The parcel. + * @return The CallCameraCapabilities. + */ + @Override + public CameraCapabilities createFromParcel(Parcel source) { + int width = source.readInt(); + int height = source.readInt(); + boolean supportsZoom = source.readByte() != 0; + float maxZoom = source.readFloat(); + + return new CameraCapabilities(width, height, supportsZoom, maxZoom); + } + + @Override + public CameraCapabilities[] newArray(int size) { + return new CameraCapabilities[size]; + } + }; + + /** + * Describe the kinds of special objects contained in this Parcelable's + * marshalled representation. + * + * @return a bitmask indicating the set of special object types marshalled + * by the Parcelable. + */ + @Override + public int describeContents() { + return 0; + } + + /** + * Flatten this object in to a Parcel. + * + * @param dest The Parcel in which the object should be written. + * @param flags Additional flags about how the object should be written. + * May be 0 or {@link #PARCELABLE_WRITE_RETURN_VALUE}. + */ + @Override + public void writeToParcel(Parcel dest, int flags) { + dest.writeInt(getWidth()); + dest.writeInt(getHeight()); + dest.writeByte((byte) (isZoomSupported() ? 1 : 0)); + dest.writeFloat(getMaxZoom()); + } + + /** + * The width of the camera video in pixels. + */ + public int getWidth() { + return mWidth; + } + + /** + * The height of the camera video in pixels. + */ + public int getHeight() { + return mHeight; + } + + /** + * Whether the camera supports zoom. + * @hide + */ + public boolean isZoomSupported() { + return mZoomSupported; + } + + /** + * The maximum zoom supported by the camera. + * @hide + */ + public float getMaxZoom() { + return mMaxZoom; + } + } + } diff --git a/telecomm/java/com/android/internal/telecom/IVideoCallback.aidl b/telecomm/java/com/android/internal/telecom/IVideoCallback.aidl index 59f8f0ce89fe6..cdfad02a96b1f 100644 --- a/telecomm/java/com/android/internal/telecom/IVideoCallback.aidl +++ b/telecomm/java/com/android/internal/telecom/IVideoCallback.aidl @@ -16,7 +16,6 @@ package com.android.internal.telecom; -import android.telecom.CameraCapabilities; import android.telecom.VideoProfile; /** @@ -41,7 +40,7 @@ oneway interface IVideoCallback { void changeCallDataUsage(long dataUsage); - void changeCameraCapabilities(in CameraCapabilities cameraCapabilities); + void changeCameraCapabilities(in VideoProfile.CameraCapabilities cameraCapabilities); void changeVideoQuality(int videoQuality); } diff --git a/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl b/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl index be8751ba3baf5..9499c9f5dde92 100644 --- a/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl +++ b/telephony/java/com/android/ims/internal/IImsVideoCallCallback.aidl @@ -16,7 +16,6 @@ package com.android.ims.internal; -import android.telecom.CameraCapabilities; import android.telecom.VideoProfile; /** @@ -43,7 +42,7 @@ oneway interface IImsVideoCallCallback { void changeCallDataUsage(long dataUsage); - void changeCameraCapabilities(in CameraCapabilities cameraCapabilities); + void changeCameraCapabilities(in VideoProfile.CameraCapabilities cameraCapabilities); void changeVideoQuality(int videoQuality); } From 3655257810aec8adea7012352e34a353d7122f11 Mon Sep 17 00:00:00 2001 From: Pierre Vandwalle Date: Mon, 11 May 2015 13:20:48 -0700 Subject: [PATCH 14/29] hal based pno and lazy roam implementation Change-Id: Ib58d40796c896a6d0dad856e0cb86c716c7aee7f --- core/res/res/values/config.xml | 14 +++-- core/res/res/values/symbols.xml | 6 ++- wifi/java/android/net/wifi/IWifiManager.aidl | 13 +++-- wifi/java/android/net/wifi/WifiManager.java | 55 ++++++++++++++++++-- 4 files changed, 74 insertions(+), 14 deletions(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index e91831a3327b1..0480b392d0c67 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -437,11 +437,17 @@ point on the move. A value of 0 means no periodic scans will be used in the framework. --> 300000 - - 15000 + + 15000 - - 20000 + + 120000 + + + 20000 + + + 180000 12 diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index 03147cfd418b6..b59e19f8d0035 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -308,7 +308,10 @@ - + + + + @@ -371,7 +374,6 @@ - diff --git a/wifi/java/android/net/wifi/IWifiManager.aidl b/wifi/java/android/net/wifi/IWifiManager.aidl index 6e6d6f6758ff6..4e3368327afba 100644 --- a/wifi/java/android/net/wifi/IWifiManager.aidl +++ b/wifi/java/android/net/wifi/IWifiManager.aidl @@ -151,17 +151,20 @@ interface IWifiManager int getVerboseLoggingLevel(); + void enableAggressiveHandover(int enabled); int getAggressiveHandover(); - void enableAggressiveHandover(int enabled); - + void setAllowScansWithTraffic(int enabled); int getAllowScansWithTraffic(); - void setAllowScansWithTraffic(int enabled); + void setAllowScansWhileAssociated(int enabled); + int getAllowScansWhileAssociated(); - boolean getAllowScansWhileAssociated(); + void setAllowNetworkSwitchingWhileAssociated(int enabled); + int getAllowNetworkSwitchingWhileAssociated(); - void setAllowScansWhileAssociated(boolean enabled); + void setHalBasedAutojoinOffload(int enabled); + int getHalBasedAutojoinOffload(); WifiConnectionStatistics getConnectionStatistics(); diff --git a/wifi/java/android/net/wifi/WifiManager.java b/wifi/java/android/net/wifi/WifiManager.java index ba045baff54d3..3d43d90c02b5a 100644 --- a/wifi/java/android/net/wifi/WifiManager.java +++ b/wifi/java/android/net/wifi/WifiManager.java @@ -2616,7 +2616,7 @@ public class WifiManager { * Set setting for allowing Scans when infrastructure is associated * @hide */ - public void setAllowScansWhileAssociated(boolean enabled) { + public void setAllowScansWhileAssociated(int enabled) { try { mService.setAllowScansWhileAssociated(enabled); } catch (RemoteException e) { @@ -2628,11 +2628,60 @@ public class WifiManager { * Get setting for allowing Scans when infrastructure is associated * @hide */ - public boolean getAllowScansWhileAssociated() { + public int getAllowScansWhileAssociated() { try { return mService.getAllowScansWhileAssociated(); } catch (RemoteException e) { } - return false; + return 0; } + + /** + * Set setting for enabling autojoin Offload thru Wifi HAL layer + * @hide + */ + public void setHalBasedAutojoinOffload(int enabled) { + try { + mService.setHalBasedAutojoinOffload(enabled); + } catch (RemoteException e) { + + } + } + + /** + * Get setting for enabling autojoin Offload thru Wifi HAL layer + * @hide + */ + public int getHalBasedAutojoinOffload() { + try { + return mService.getHalBasedAutojoinOffload(); + } catch (RemoteException e) { + } + return 0; + } + + /** + * Set setting for enabling network switching while wifi is associated + * @hide + */ + public void setAllowNetworkSwitchingWhileAssociated(int enabled) { + try { + mService.setAllowNetworkSwitchingWhileAssociated(enabled); + } catch (RemoteException e) { + + } + } + + /** + * Get setting for enabling network switching while wifi is associated + * @hide + */ + public int getAllowNetworkSwitchingWhileAssociated() { + try { + return mService.getAllowNetworkSwitchingWhileAssociated(); + } catch (RemoteException e) { + } + return 0; + } + } From 5c850671778016a2fa4b4af76c0a945984e3538c Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Wed, 13 May 2015 18:55:18 -0700 Subject: [PATCH 15/29] DO NOT MERGE Make Conferenceable an abstract class Bug: 21066017 Change-Id: Ibcbccfc7b1380e417b464aed9b968cbc0a6a1cc2 --- api/current.txt | 14 +++++++------- api/system-current.txt | 14 +++++++------- telecomm/java/android/telecom/Conference.java | 3 +-- ...IConferenceable.java => Conferenceable.java} | 8 ++++---- telecomm/java/android/telecom/Connection.java | 17 ++++++++--------- .../java/android/telecom/ConnectionService.java | 10 +++++----- 6 files changed, 32 insertions(+), 34 deletions(-) rename telecomm/java/android/telecom/{IConferenceable.java => Conferenceable.java} (79%) diff --git a/api/current.txt b/api/current.txt index 657b806dcb2a8..704db3134e66c 100644 --- a/api/current.txt +++ b/api/current.txt @@ -28426,7 +28426,7 @@ package android.telecom { field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5 } - public abstract class Conference implements android.telecom.IConferenceable { + public abstract class Conference extends android.telecom.Conferenceable { ctor public Conference(android.telecom.PhoneAccountHandle); method public final boolean addConnection(android.telecom.Connection); method public final void destroy(); @@ -28466,7 +28466,10 @@ package android.telecom { field public static final long CONNECT_TIME_NOT_SPECIFIED = 0L; // 0x0L } - public abstract class Connection implements android.telecom.IConferenceable { + public abstract class Conferenceable { + } + + public abstract class Connection extends android.telecom.Conferenceable { ctor public Connection(); method public static java.lang.String capabilitiesToString(int); method public static android.telecom.Connection createCanceledConnection(); @@ -28479,7 +28482,7 @@ package android.telecom { method public final java.lang.String getCallerDisplayName(); method public final int getCallerDisplayNamePresentation(); method public final android.telecom.Conference getConference(); - method public final java.util.List getConferenceables(); + method public final java.util.List getConferenceables(); method public final int getConnectionCapabilities(); method public final android.telecom.DisconnectCause getDisconnectCause(); method public final int getState(); @@ -28504,7 +28507,7 @@ package android.telecom { method public final void setAudioModeIsVoip(boolean); method public final void setCallerDisplayName(java.lang.String, int); method public final void setConferenceableConnections(java.util.List); - method public final void setConferenceables(java.util.List); + method public final void setConferenceables(java.util.List); method public final void setConnectionCapabilities(int); method public final void setConnectionService(android.telecom.ConnectionService); method public final void setDialing(); @@ -28643,9 +28646,6 @@ package android.telecom { field public static final android.os.Parcelable.Creator CREATOR; } - public abstract interface IConferenceable { - } - public abstract class InCallService extends android.app.Service { ctor public InCallService(); method public final boolean canAddCall(); diff --git a/api/system-current.txt b/api/system-current.txt index 3cd8abb0aca1f..3efe5a9526745 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -30266,7 +30266,7 @@ package android.telecom { field public static final int ROUTE_WIRED_OR_EARPIECE = 5; // 0x5 } - public abstract class Conference implements android.telecom.IConferenceable { + public abstract class Conference extends android.telecom.Conferenceable { ctor public Conference(android.telecom.PhoneAccountHandle); method public final boolean addConnection(android.telecom.Connection); method public final void destroy(); @@ -30308,7 +30308,10 @@ package android.telecom { field public static final long CONNECT_TIME_NOT_SPECIFIED = 0L; // 0x0L } - public abstract class Connection implements android.telecom.IConferenceable { + public abstract class Conferenceable { + } + + public abstract class Connection extends android.telecom.Conferenceable { ctor public Connection(); method public static java.lang.String capabilitiesToString(int); method public static android.telecom.Connection createCanceledConnection(); @@ -30322,7 +30325,7 @@ package android.telecom { method public final java.lang.String getCallerDisplayName(); method public final int getCallerDisplayNamePresentation(); method public final android.telecom.Conference getConference(); - method public final java.util.List getConferenceables(); + method public final java.util.List getConferenceables(); method public final int getConnectionCapabilities(); method public final android.telecom.DisconnectCause getDisconnectCause(); method public final int getState(); @@ -30348,7 +30351,7 @@ package android.telecom { method public final void setAudioModeIsVoip(boolean); method public final void setCallerDisplayName(java.lang.String, int); method public final void setConferenceableConnections(java.util.List); - method public final void setConferenceables(java.util.List); + method public final void setConferenceables(java.util.List); method public final void setConnectionCapabilities(int); method public final void setConnectionService(android.telecom.ConnectionService); method public final void setDialing(); @@ -30487,9 +30490,6 @@ package android.telecom { field public static final android.os.Parcelable.Creator CREATOR; } - public abstract interface IConferenceable { - } - public abstract class InCallService extends android.app.Service { ctor public InCallService(); method public final boolean canAddCall(); diff --git a/telecomm/java/android/telecom/Conference.java b/telecomm/java/android/telecom/Conference.java index 0da755fe8a783..182ac121e245a 100644 --- a/telecomm/java/android/telecom/Conference.java +++ b/telecomm/java/android/telecom/Conference.java @@ -30,8 +30,7 @@ import java.util.concurrent.CopyOnWriteArraySet; /** * Represents a conference call which can contain any number of {@link Connection} objects. */ -public abstract class Conference implements IConferenceable { - +public abstract class Conference extends Conferenceable { /** * Used to indicate that the conference connection time is not specified. If not specified, * Telecom will set the connect time. diff --git a/telecomm/java/android/telecom/IConferenceable.java b/telecomm/java/android/telecom/Conferenceable.java similarity index 79% rename from telecomm/java/android/telecom/IConferenceable.java rename to telecomm/java/android/telecom/Conferenceable.java index a9be20b6ea8fd..bb6f2b8b34559 100644 --- a/telecomm/java/android/telecom/IConferenceable.java +++ b/telecomm/java/android/telecom/Conferenceable.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014 The Android Open Source Project + * Copyright (C) 2015 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. @@ -19,8 +19,8 @@ package android.telecom; /** * Interface used to identify entities with which another entity can participate in a conference * call with. The {@link ConnectionService} implementation will only recognize - * {@link IConferenceable}s which are {@link Connection}s or {@link Conference}s. + * {@link Conferenceable}s which are {@link Connection}s or {@link Conference}s. */ -public interface IConferenceable { - +public abstract class Conferenceable { + Conferenceable() {} } diff --git a/telecomm/java/android/telecom/Connection.java b/telecomm/java/android/telecom/Connection.java index 6b555dce90d16..ecee0c60c04f7 100644 --- a/telecomm/java/android/telecom/Connection.java +++ b/telecomm/java/android/telecom/Connection.java @@ -47,8 +47,7 @@ import java.util.concurrent.ConcurrentHashMap; * must call {@link #destroy()} to signal to the framework that the {@code Connection} is no * longer used and associated resources may be recovered. */ -public abstract class Connection implements IConferenceable { - +public abstract class Connection extends Conferenceable { public static final int STATE_INITIALIZING = 0; public static final int STATE_NEW = 1; @@ -327,7 +326,7 @@ public abstract class Connection implements IConferenceable { public void onAudioModeIsVoipChanged(Connection c, boolean isVoip) {} public void onStatusHintsChanged(Connection c, StatusHints statusHints) {} public void onConferenceablesChanged( - Connection c, List conferenceables) {} + Connection c, List conferenceables) {} public void onConferenceChanged(Connection c, Conference conference) {} /** @hide */ public void onConferenceParticipantsChanged(Connection c, @@ -813,8 +812,8 @@ public abstract class Connection implements IConferenceable { */ private final Set mListeners = Collections.newSetFromMap( new ConcurrentHashMap(8, 0.9f, 1)); - private final List mConferenceables = new ArrayList<>(); - private final List mUnmodifiableConferenceables = + private final List mConferenceables = new ArrayList<>(); + private final List mUnmodifiableConferenceables = Collections.unmodifiableList(mConferenceables); private int mState = STATE_NEW; @@ -1282,9 +1281,9 @@ public abstract class Connection implements IConferenceable { * * @param conferenceables The conferenceables. */ - public final void setConferenceables(List conferenceables) { + public final void setConferenceables(List conferenceables) { clearConferenceableList(); - for (IConferenceable c : conferenceables) { + for (Conferenceable c : conferenceables) { // If statement checks for duplicates in input. It makes it N^2 but we're dealing with a // small amount of items here. if (!mConferenceables.contains(c)) { @@ -1304,7 +1303,7 @@ public abstract class Connection implements IConferenceable { /** * Returns the connections or conferences with which this connection can be conferenced. */ - public final List getConferenceables() { + public final List getConferenceables() { return mUnmodifiableConferenceables; } @@ -1579,7 +1578,7 @@ public abstract class Connection implements IConferenceable { } private final void clearConferenceableList() { - for (IConferenceable c : mConferenceables) { + for (Conferenceable c : mConferenceables) { if (c instanceof Connection) { Connection connection = (Connection) c; connection.removeConnectionListener(mConnectionDeathListener); diff --git a/telecomm/java/android/telecom/ConnectionService.java b/telecomm/java/android/telecom/ConnectionService.java index 5715dff7460b7..199100b3e5f38 100644 --- a/telecomm/java/android/telecom/ConnectionService.java +++ b/telecomm/java/android/telecom/ConnectionService.java @@ -544,7 +544,7 @@ public abstract class ConnectionService extends Service { @Override public void onConferenceablesChanged( - Connection connection, List conferenceables) { + Connection connection, List conferenceables) { mAdapter.setConferenceableConnections( mIdByConnection.get(connection), createIdList(conferenceables)); @@ -1184,14 +1184,14 @@ public abstract class ConnectionService extends Service { /** * Builds a list of {@link Connection} and {@link Conference} IDs based on the list of - * {@link IConferenceable}s passed in. + * {@link Conferenceable}s passed in. * - * @param conferenceables The {@link IConferenceable} connections and conferences. + * @param conferenceables The {@link Conferenceable} connections and conferences. * @return List of string conference and call Ids. */ - private List createIdList(List conferenceables) { + private List createIdList(List conferenceables) { List ids = new ArrayList<>(); - for (IConferenceable c : conferenceables) { + for (Conferenceable c : conferenceables) { // Only allow Connection and Conference conferenceables. if (c instanceof Connection) { Connection connection = (Connection) c; From 7bd553fc119e12a64dccce7b2846ec76a3478353 Mon Sep 17 00:00:00 2001 From: Anthony Lee Date: Fri, 15 May 2015 16:22:39 -0700 Subject: [PATCH 16/29] Add Carrier Presence to CP2: Phone Carrier Presence (RCS-based) is required for IMS-based telephony services: VoLTE, WFC, and VT (Video Telephony). Public API in the form of Presence column is added to Phone. Initial bit-field is defined for for VT capability. Change-Id: Ice78f895acf89a91f7478115e64caeb8d26f5456 --- api/current.txt | 2 ++ api/system-current.txt | 2 ++ core/java/android/provider/ContactsContract.java | 15 +++++++++++++++ 3 files changed, 19 insertions(+) diff --git a/api/current.txt b/api/current.txt index 704db3134e66c..d187675e109c8 100644 --- a/api/current.txt +++ b/api/current.txt @@ -24457,6 +24457,8 @@ package android.provider { } protected static abstract interface ContactsContract.DataColumns { + field public static final java.lang.String CARRIER_PRESENCE = "carrier_presence"; + field public static final int CARRIER_PRESENCE_VT_CAPABLE = 1; // 0x1 field public static final java.lang.String DATA1 = "data1"; field public static final java.lang.String DATA10 = "data10"; field public static final java.lang.String DATA11 = "data11"; diff --git a/api/system-current.txt b/api/system-current.txt index 3efe5a9526745..01559250f5af9 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -26151,6 +26151,8 @@ package android.provider { } protected static abstract interface ContactsContract.DataColumns { + field public static final java.lang.String CARRIER_PRESENCE = "carrier_presence"; + field public static final int CARRIER_PRESENCE_VT_CAPABLE = 1; // 0x1 field public static final java.lang.String DATA1 = "data1"; field public static final java.lang.String DATA10 = "data10"; field public static final java.lang.String DATA11 = "data11"; diff --git a/core/java/android/provider/ContactsContract.java b/core/java/android/provider/ContactsContract.java index 18a9eb1d0e8b2..a76902be6653d 100644 --- a/core/java/android/provider/ContactsContract.java +++ b/core/java/android/provider/ContactsContract.java @@ -4082,6 +4082,21 @@ public final class ContactsContract { public static final String SYNC3 = "data_sync3"; /** Generic column for use by sync adapters. */ public static final String SYNC4 = "data_sync4"; + + /** + * Carrier presence information. + *

+ * Type: INTEGER (A bitmask of CARRIER_PRESENCE_* fields) + *

+ */ + public static final String CARRIER_PRESENCE = "carrier_presence"; + + /** + * Bitmask flags for CARRIER_PRESENCE column. Each value represents + * a bit (or a set of bits) which may be set independently of each + * other. + */ + public static final int CARRIER_PRESENCE_VT_CAPABLE = 0x01; } /** From a3031890abe58932d85ef9b45f2c81eb8a11cac4 Mon Sep 17 00:00:00 2001 From: Hemant Gupta Date: Fri, 30 May 2014 22:25:20 +0530 Subject: [PATCH 17/29] DO NOT MERGE OBEX: Handle GET operation properly This change handles GET operation properly whenever the Input stream is getting aborted in between. Without this patch it was observed that GET request was being sent by DUT even when abort has been sent/received resulting in IOT issues with some remote devices including PTS. Change-Id: Idcb4ea04abb57353af5ab1fef050b3a36579892e --- obex/javax/obex/ClientOperation.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/obex/javax/obex/ClientOperation.java b/obex/javax/obex/ClientOperation.java index cc20d391ab759..883c8c6ed75d2 100644 --- a/obex/javax/obex/ClientOperation.java +++ b/obex/javax/obex/ClientOperation.java @@ -784,12 +784,12 @@ public final class ClientOperation implements Operation, BaseStream { mReplyHeader.responseCode = ResponseCodes.OBEX_HTTP_CONTINUE; } - while (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE) { + while (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE && !mOperationDone) { if (!sendRequest(ObexHelper.OBEX_OPCODE_GET_FINAL)) { break; } } - while (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE) { + while (mReplyHeader.responseCode == ResponseCodes.OBEX_HTTP_CONTINUE && !mOperationDone) { mParent.sendRequest(ObexHelper.OBEX_OPCODE_GET_FINAL, null, mReplyHeader, mPrivateInput, false); // Regardless of the SRM state, wait for the response. From 3ab204a0fa62631beef88de9a5d1da4649f51716 Mon Sep 17 00:00:00 2001 From: Hemant Gupta Date: Sun, 15 Feb 2015 18:56:54 +0530 Subject: [PATCH 18/29] DO NOT MERGE Bluetooth: Check for mPanService before changing tethering state Checking for mPanService before changing OR checking tethering state, otherwise it will lead to application crash while checking isTetheringOn OR changing tethering state. Change-Id: I00844c03cdb8616118c1d50d7d31c75e51f0ef9b --- core/java/android/bluetooth/BluetoothPan.java | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/core/java/android/bluetooth/BluetoothPan.java b/core/java/android/bluetooth/BluetoothPan.java index 4f81f9863c543..eb6166acee300 100644 --- a/core/java/android/bluetooth/BluetoothPan.java +++ b/core/java/android/bluetooth/BluetoothPan.java @@ -333,19 +333,25 @@ public final class BluetoothPan implements BluetoothProfile { public void setBluetoothTethering(boolean value) { if (DBG) log("setBluetoothTethering(" + value + ")"); - try { - mPanService.setBluetoothTethering(value); - } catch (RemoteException e) { - Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + + if (mPanService != null && isEnabled()) { + try { + mPanService.setBluetoothTethering(value); + } catch (RemoteException e) { + Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + } } } public boolean isTetheringOn() { if (VDBG) log("isTetheringOn()"); - try { - return mPanService.isTetheringOn(); - } catch (RemoteException e) { - Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + + if (mPanService != null && isEnabled()) { + try { + return mPanService.isTetheringOn(); + } catch (RemoteException e) { + Log.e(TAG, "Stack:" + Log.getStackTraceString(new Throwable())); + } } return false; } From 95052eb3f52d18ac9b130dacb2fd8ec47721b3f9 Mon Sep 17 00:00:00 2001 From: fenglu Date: Fri, 1 May 2015 17:04:36 -0700 Subject: [PATCH 19/29] LCE feature enhancement - space pollLceData calls every 500ms - cluster multiple pending pollLceData calls into one Change-Id: I04513011db3ae29af02bd54fe91cb8e0d4ab9f12 --- core/java/android/net/NetworkAgent.java | 19 +++++++++++++++++-- 1 file changed, 17 insertions(+), 2 deletions(-) diff --git a/core/java/android/net/NetworkAgent.java b/core/java/android/net/NetworkAgent.java index c33aa2f551325..74b2d528a8e44 100644 --- a/core/java/android/net/NetworkAgent.java +++ b/core/java/android/net/NetworkAgent.java @@ -54,6 +54,8 @@ public abstract class NetworkAgent extends Handler { private final ArrayListmPreConnectedQueue = new ArrayList(); private volatile long mLastBwRefreshTime = 0; private static final long BW_REFRESH_MIN_WIN_MS = 500; + private boolean mPollLceScheduled = false; + private AtomicBoolean mPollLcePending = new AtomicBoolean(false); private static final int BASE = Protocol.BASE_NETWORK_AGENT; @@ -200,11 +202,23 @@ public abstract class NetworkAgent extends Handler { break; } case CMD_REQUEST_BANDWIDTH_UPDATE: { + long currentTimeMs = System.currentTimeMillis(); if (VDBG) { log("CMD_REQUEST_BANDWIDTH_UPDATE request received."); } - if (System.currentTimeMillis() > (mLastBwRefreshTime + BW_REFRESH_MIN_WIN_MS)) { - pollLceData(); + if (currentTimeMs >= (mLastBwRefreshTime + BW_REFRESH_MIN_WIN_MS)) { + mPollLceScheduled = false; + if (mPollLcePending.getAndSet(true) == false) { + pollLceData(); + } + } else { + // deliver the request at a later time rather than discard it completely. + if (!mPollLceScheduled) { + long waitTime = mLastBwRefreshTime + BW_REFRESH_MIN_WIN_MS - + currentTimeMs + 1; + mPollLceScheduled = sendEmptyMessageDelayed( + CMD_REQUEST_BANDWIDTH_UPDATE, waitTime); + } } break; } @@ -250,6 +264,7 @@ public abstract class NetworkAgent extends Handler { * Called by the bearer code when it has new NetworkCapabilities data. */ public void sendNetworkCapabilities(NetworkCapabilities networkCapabilities) { + mPollLcePending.set(false); mLastBwRefreshTime = System.currentTimeMillis(); queueOrSendMessage(EVENT_NETWORK_CAPABILITIES_CHANGED, new NetworkCapabilities(networkCapabilities)); From 4451685c7fd16c9a9a77791bb5bc9e4f23f1b6e8 Mon Sep 17 00:00:00 2001 From: xinhe Date: Tue, 19 May 2015 11:25:39 -0700 Subject: [PATCH 20/29] Rename HandlerThread name in RttManager The sHandlerThread name in RttManager is called "WifiScanner". It should be changed to RTTManager Bug:21299667 Change-Id: I545d0810544295fb39d95b5c3d8fe89c3b8fc073 --- wifi/java/android/net/wifi/RttManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/wifi/java/android/net/wifi/RttManager.java b/wifi/java/android/net/wifi/RttManager.java index dde8dba19f902..7ced12650128a 100644 --- a/wifi/java/android/net/wifi/RttManager.java +++ b/wifi/java/android/net/wifi/RttManager.java @@ -958,7 +958,7 @@ public class RttManager { return; } - sHandlerThread = new HandlerThread("WifiScanner"); + sHandlerThread = new HandlerThread("RttManager"); sAsyncChannel = new AsyncChannel(); sConnected = new CountDownLatch(1); From 4f7606eb88ffcaa264aeb29241c59c403a879f25 Mon Sep 17 00:00:00 2001 From: Pierre Vandwalle Date: Tue, 19 May 2015 18:36:39 -0700 Subject: [PATCH 21/29] enable SSID whitelist Change-Id: Ic95a0ecd1d7ad7ae2a0f6232b2e8688fdb41dcc2 --- core/res/res/values/config.xml | 5 ++++- core/res/res/values/symbols.xml | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index 0480b392d0c67..d5097e47e45fb 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -496,7 +496,10 @@ false - false + true + + + true 1 diff --git a/core/res/res/values/symbols.xml b/core/res/res/values/symbols.xml index b59e19f8d0035..18f5cacce848c 100755 --- a/core/res/res/values/symbols.xml +++ b/core/res/res/values/symbols.xml @@ -376,6 +376,7 @@ + From e391b136ff194e832eb143b86b8c5a0053c23053 Mon Sep 17 00:00:00 2001 From: Nitin Arora Date: Thu, 7 May 2015 18:45:44 -0700 Subject: [PATCH 22/29] DO NOT MERGE Bluetooth: Clear BLE always ON apps at Airplane mode This patch clears the container managing the Ble Always On apps while switching on, the airplane mode. The airplane mode will completely turn Off the Bleutooth Adapter from any state it is in. Change-Id: Ib28d39d85efe3aac37e3a53a4fb892099568c702 --- .../core/java/com/android/server/BluetoothManagerService.java | 1 + 1 file changed, 1 insertion(+) diff --git a/services/core/java/com/android/server/BluetoothManagerService.java b/services/core/java/com/android/server/BluetoothManagerService.java index 2cc5ff0601d67..24611fd8d57d6 100644 --- a/services/core/java/com/android/server/BluetoothManagerService.java +++ b/services/core/java/com/android/server/BluetoothManagerService.java @@ -204,6 +204,7 @@ class BluetoothManagerService extends IBluetoothManager.Stub { // Clear registered LE apps to force shut-off synchronized (this) { mBleAppCount = 0; + mBleApps.clear(); } if (st == BluetoothAdapter.STATE_BLE_ON) { //if state is BLE_ON make sure you trigger disableBLE part From c4ea0369dd01ec1ed53b5c8930d2f3831d793442 Mon Sep 17 00:00:00 2001 From: Pierre Vandwalle Date: Wed, 20 May 2015 15:15:31 -0700 Subject: [PATCH 23/29] fix annoying typo Change-Id: Ic8411d622755ee168da6495d2e86201fb3c1154f --- wifi/java/android/net/wifi/WifiConfiguration.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/wifi/java/android/net/wifi/WifiConfiguration.java b/wifi/java/android/net/wifi/WifiConfiguration.java index feab4b8a91d0b..09af531921a42 100644 --- a/wifi/java/android/net/wifi/WifiConfiguration.java +++ b/wifi/java/android/net/wifi/WifiConfiguration.java @@ -1071,7 +1071,7 @@ public class WifiConfiguration implements Parcelable { if (diff <= 0) { sbuf.append(" blackListed since "); } else { - sbuf.append(" blackListed: ").append(Long.toString(diff/1000)).append( "sec"); + sbuf.append(" blackListed: ").append(Long.toString(diff/1000)).append( "sec "); } } if (this.lastConnected != 0) { @@ -1080,27 +1080,27 @@ public class WifiConfiguration implements Parcelable { if (diff <= 0) { sbuf.append("lastConnected since "); } else { - sbuf.append("lastConnected: ").append(Long.toString(diff/1000)).append( "sec"); + sbuf.append("lastConnected: ").append(Long.toString(diff/1000)).append( "sec "); } } if (this.lastConnectionFailure != 0) { sbuf.append('\n'); long diff = now_ms - this.lastConnectionFailure; if (diff <= 0) { - sbuf.append("lastConnectionFailure since "); + sbuf.append("lastConnectionFailure since "); } else { sbuf.append("lastConnectionFailure: ").append(Long.toString(diff/1000)); - sbuf.append( "sec"); + sbuf.append( "sec "); } } if (this.lastRoamingFailure != 0) { sbuf.append('\n'); long diff = now_ms - this.lastRoamingFailure; if (diff <= 0) { - sbuf.append("lastRoamingFailure since "); + sbuf.append("lastRoamingFailure since "); } else { sbuf.append("lastRoamingFailure: ").append(Long.toString(diff/1000)); - sbuf.append( "sec"); + sbuf.append( "sec "); } } sbuf.append("roamingFailureBlackListTimeMilli: "). From e447fcd445f339f12d81dafa98a3b8d8a6a1ae7e Mon Sep 17 00:00:00 2001 From: Pierre Vandwalle Date: Wed, 20 May 2015 18:23:45 -0700 Subject: [PATCH 24/29] keep hal based pno disabled by default Change-Id: Ia0de13fa127877a6bfd8b46b5a8b940b1faa7f3d --- core/res/res/values/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/res/res/values/config.xml b/core/res/res/values/config.xml index d5097e47e45fb..efbd24b863248 100755 --- a/core/res/res/values/config.xml +++ b/core/res/res/values/config.xml @@ -496,7 +496,7 @@ false - true + false true From 21dd47c33e70451a1ef07446107ddbd4023001e8 Mon Sep 17 00:00:00 2001 From: Etan Cohen Date: Tue, 26 May 2015 10:48:22 -0700 Subject: [PATCH 25/29] Revert "Disable VT over IMS feature." This reverts commit f8904dccf4c1c2cd7f027ddafbea6d75748591b2. --- core/res/res/values-mcc311-mnc480/config.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/res/res/values-mcc311-mnc480/config.xml b/core/res/res/values-mcc311-mnc480/config.xml index a986b75b9fd56..39ea2bf1f5aae 100755 --- a/core/res/res/values-mcc311-mnc480/config.xml +++ b/core/res/res/values-mcc311-mnc480/config.xml @@ -46,7 +46,7 @@ - false + true true From 56fbb20da1d9fc731abb423f637cbf6f15afcff7 Mon Sep 17 00:00:00 2001 From: Soonil Nagarkar Date: Tue, 26 May 2015 17:32:13 -0700 Subject: [PATCH 26/29] Add NO_BATCH flag to WifiScanner Change-Id: Ic9971260d88793c35ce13bf2e1b64f7b6ef08e65 --- wifi/java/android/net/wifi/WifiScanner.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java index fea934f860c67..bd0ded1e5b740 100644 --- a/wifi/java/android/net/wifi/WifiScanner.java +++ b/wifi/java/android/net/wifi/WifiScanner.java @@ -136,12 +136,17 @@ public class WifiScanner { } } - /** reports {@link ScanListener#onResults} when underlying buffers are full */ + /** reports {@link ScanListener#onResults} when underlying buffers are full + * @deprecated + */ + @Deprecated public static final int REPORT_EVENT_AFTER_BUFFER_FULL = 0; /** reports {@link ScanListener#onResults} after each scan */ public static final int REPORT_EVENT_AFTER_EACH_SCAN = 1; /** reports {@link ScanListener#onFullResult} whenever each beacon is discovered */ public static final int REPORT_EVENT_FULL_SCAN_RESULT = 2; + /** do not batch */ + public static final int REPORT_EVENT_NO_BATCH = 4; /** * scan configuration parameters to be sent to {@link #startBackgroundScan} From 5b2b40a0d5cca2a5f19fbb5e0e99348c5c30ce62 Mon Sep 17 00:00:00 2001 From: Soonil Nagarkar Date: Wed, 27 May 2015 10:37:08 -0700 Subject: [PATCH 27/29] Revert "Add NO_BATCH flag to WifiScanner" This reverts commit 56fbb20da1d9fc731abb423f637cbf6f15afcff7. --- wifi/java/android/net/wifi/WifiScanner.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java index bd0ded1e5b740..fea934f860c67 100644 --- a/wifi/java/android/net/wifi/WifiScanner.java +++ b/wifi/java/android/net/wifi/WifiScanner.java @@ -136,17 +136,12 @@ public class WifiScanner { } } - /** reports {@link ScanListener#onResults} when underlying buffers are full - * @deprecated - */ - @Deprecated + /** reports {@link ScanListener#onResults} when underlying buffers are full */ public static final int REPORT_EVENT_AFTER_BUFFER_FULL = 0; /** reports {@link ScanListener#onResults} after each scan */ public static final int REPORT_EVENT_AFTER_EACH_SCAN = 1; /** reports {@link ScanListener#onFullResult} whenever each beacon is discovered */ public static final int REPORT_EVENT_FULL_SCAN_RESULT = 2; - /** do not batch */ - public static final int REPORT_EVENT_NO_BATCH = 4; /** * scan configuration parameters to be sent to {@link #startBackgroundScan} From b9e6d98c6c0a05ebfc73a14d1ac2a47d58290241 Mon Sep 17 00:00:00 2001 From: Soonil Nagarkar Date: Wed, 27 May 2015 11:23:37 -0700 Subject: [PATCH 28/29] Add NO_BATCH flag to WifiScanner Change-Id: Idd521f724684986ff84306327d42b810f7b30245 --- api/system-current.txt | 3 ++- wifi/java/android/net/wifi/WifiScanner.java | 7 ++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/api/system-current.txt b/api/system-current.txt index 01559250f5af9..904c2493072b2 100644 --- a/api/system-current.txt +++ b/api/system-current.txt @@ -19799,9 +19799,10 @@ package android.net.wifi { field public static final int REASON_NOT_AUTHORIZED = -4; // 0xfffffffc field public static final int REASON_SUCCEEDED = 0; // 0x0 field public static final int REASON_UNSPECIFIED = -1; // 0xffffffff - field public static final int REPORT_EVENT_AFTER_BUFFER_FULL = 0; // 0x0 + field public static final deprecated int REPORT_EVENT_AFTER_BUFFER_FULL = 0; // 0x0 field public static final int REPORT_EVENT_AFTER_EACH_SCAN = 1; // 0x1 field public static final int REPORT_EVENT_FULL_SCAN_RESULT = 2; // 0x2 + field public static final int REPORT_EVENT_NO_BATCH = 4; // 0x4 field public static final int WIFI_BAND_24_GHZ = 1; // 0x1 field public static final int WIFI_BAND_5_GHZ = 2; // 0x2 field public static final int WIFI_BAND_5_GHZ_DFS_ONLY = 4; // 0x4 diff --git a/wifi/java/android/net/wifi/WifiScanner.java b/wifi/java/android/net/wifi/WifiScanner.java index fea934f860c67..bd0ded1e5b740 100644 --- a/wifi/java/android/net/wifi/WifiScanner.java +++ b/wifi/java/android/net/wifi/WifiScanner.java @@ -136,12 +136,17 @@ public class WifiScanner { } } - /** reports {@link ScanListener#onResults} when underlying buffers are full */ + /** reports {@link ScanListener#onResults} when underlying buffers are full + * @deprecated + */ + @Deprecated public static final int REPORT_EVENT_AFTER_BUFFER_FULL = 0; /** reports {@link ScanListener#onResults} after each scan */ public static final int REPORT_EVENT_AFTER_EACH_SCAN = 1; /** reports {@link ScanListener#onFullResult} whenever each beacon is discovered */ public static final int REPORT_EVENT_FULL_SCAN_RESULT = 2; + /** do not batch */ + public static final int REPORT_EVENT_NO_BATCH = 4; /** * scan configuration parameters to be sent to {@link #startBackgroundScan} From a107edd21bb53320897fddaeeb998872cc67e4e4 Mon Sep 17 00:00:00 2001 From: Etan Cohen Date: Thu, 28 May 2015 15:53:20 -0700 Subject: [PATCH 29/29] Rename VoLTE/WFC enable API to available - add VT available API. Renamed API to use consistent semantics: available refers to the current state of the service rather then whether feature is enabled by device/carrier/ user. Added VT API to match VoLTE/WFC. Change-Id: Ifb31f123db77e731e75a982b8594168f59a289e7 --- .../android/telephony/TelephonyManager.java | 38 +++++++++++++------ .../internal/telephony/ITelephony.aidl | 14 +++++-- 2 files changed, 36 insertions(+), 16 deletions(-) diff --git a/telephony/java/android/telephony/TelephonyManager.java b/telephony/java/android/telephony/TelephonyManager.java index a47f5e9d0a447..3d66bdaf1f044 100644 --- a/telephony/java/android/telephony/TelephonyManager.java +++ b/telephony/java/android/telephony/TelephonyManager.java @@ -4181,13 +4181,13 @@ public class TelephonyManager { } } - /** - * Returns the Status of Volte - *@hide - */ - public boolean isVolteEnabled() { + /** + * Returns the Status of Volte + * @hide + */ + public boolean isVolteAvailable() { try { - return getITelephony().isVolteEnabled(); + return getITelephony().isVolteAvailable(); } catch (RemoteException ex) { return false; } catch (NullPointerException ex) { @@ -4195,13 +4195,27 @@ public class TelephonyManager { } } - /** - * Returns the Status of Wi-Fi Calling - *@hide - */ - public boolean isWifiCallingEnabled() { + /** + * Returns the Status of video telephony (VT) + * @hide + */ + public boolean isVideoTelephonyAvailable() { + try { + return getITelephony().isVideoTelephonyAvailable(); + } catch (RemoteException ex) { + return false; + } catch (NullPointerException ex) { + return false; + } + } + + /** + * Returns the Status of Wi-Fi Calling + * @hide + */ + public boolean isWifiCallingAvailable() { try { - return getITelephony().isWifiCallingEnabled(); + return getITelephony().isWifiCallingAvailable(); } catch (RemoteException ex) { return false; } catch (NullPointerException ex) { diff --git a/telephony/java/com/android/internal/telephony/ITelephony.aidl b/telephony/java/com/android/internal/telephony/ITelephony.aidl index 11d0ea6db74c0..790397ee2919b 100644 --- a/telephony/java/com/android/internal/telephony/ITelephony.aidl +++ b/telephony/java/com/android/internal/telephony/ITelephony.aidl @@ -921,13 +921,19 @@ interface ITelephony { * Returns the Status of Wi-Fi Calling *@hide */ - boolean isWifiCallingEnabled(); - - /** + boolean isWifiCallingAvailable(); + + /** * Returns the Status of Volte *@hide */ - boolean isVolteEnabled(); + boolean isVolteAvailable(); + + /** + * Returns the Status of VT (video telephony) + *@hide + */ + boolean isVideoTelephonyAvailable(); /** * Returns the unique device ID of phone, for example, the IMEI for