return service.isA2dpPlaying(device);
}
};
+
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ if (mStateMachine != null) {
+ mStateMachine.dump(sb);
+ }
+ if (mAvrcp != null) {
+ mAvrcp.dump(sb);
+ }
+ }
}
return service.getAudioConfig(device);
}
};
+
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ if (mStateMachine != null) {
+ mStateMachine.dump(sb);
+ }
+ }
}
mAudioConfigs.clear();
}
- private class Disconnected extends State {
+ public void dump(StringBuilder sb) {
+ ProfileService.println(sb, "mCurrentDevice: " + mCurrentDevice);
+ ProfileService.println(sb, "mTargetDevice: " + mTargetDevice);
+ ProfileService.println(sb, "mIncomingDevice: " + mIncomingDevice);
+ ProfileService.println(sb, "StateMachine: " + this.toString());
+ }
+
+ private class Disconnected extends State {
@Override
public void enter() {
log("Enter Disconnected: " + getCurrentMessage().what);
mIntentBroadcastHandler = new IntentBroadcastHandler();
mAudioManager = (AudioManager) context.getSystemService(Context.AUDIO_SERVICE);
-
}
static A2dpStateMachine make(A2dpService svc, Context context) {
}
}
+ public void dump(StringBuilder sb) {
+ ProfileService.println(sb, "mCurrentDevice: " + mCurrentDevice);
+ ProfileService.println(sb, "mTargetDevice: " + mTargetDevice);
+ ProfileService.println(sb, "mIncomingDevice: " + mIncomingDevice);
+ ProfileService.println(sb, "mPlayingA2dpDevice: " + mPlayingA2dpDevice);
+ ProfileService.println(sb, "StateMachine: " + this.toString());
+ }
// Event types for STACK_EVENT message
final private static int EVENT_TYPE_NONE = 0;
mHandler.sendMessage(msg);
}
+ public void dump(StringBuilder sb) {
+ sb.append("AVRCP:\n");
+ ProfileService.println(sb, "mMetadata: " + mMetadata);
+ ProfileService.println(sb, "mTransportControlFlags: " + mTransportControlFlags);
+ ProfileService.println(sb, "mCurrentPlayState: " + mCurrentPlayState);
+ ProfileService.println(sb, "mPlayStatusChangedNT: " + mPlayStatusChangedNT);
+ ProfileService.println(sb, "mTrackChangedNT: " + mTrackChangedNT);
+ ProfileService.println(sb, "mTrackNumber: " + mTrackNumber);
+ ProfileService.println(sb, "mCurrentPosMs: " + mCurrentPosMs);
+ ProfileService.println(sb, "mPlayStartTimeMs: " + mPlayStartTimeMs);
+ ProfileService.println(sb, "mSongLengthMs: " + mSongLengthMs);
+ ProfileService.println(sb, "mPlaybackIntervalMs: " + mPlaybackIntervalMs);
+ ProfileService.println(sb, "mPlayPosChangedNT: " + mPlayPosChangedNT);
+ ProfileService.println(sb, "mNextPosMs: " + mNextPosMs);
+ ProfileService.println(sb, "mPrevPosMs: " + mPrevPosMs);
+ ProfileService.println(sb, "mSkipStartTime: " + mSkipStartTime);
+ ProfileService.println(sb, "mFeatures: " + mFeatures);
+ ProfileService.println(sb, "mAbsoluteVolume: " + mAbsoluteVolume);
+ ProfileService.println(sb, "mLastSetVolume: " + mLastSetVolume);
+ ProfileService.println(sb, "mLastDirection: " + mLastDirection);
+ ProfileService.println(sb, "mVolumeStep: " + mVolumeStep);
+ ProfileService.println(sb, "mAudioStreamMax: " + mAudioStreamMax);
+ ProfileService.println(sb, "mVolCmdInProgress: " + mVolCmdInProgress);
+ ProfileService.println(sb, "mAbsVolRetryTimes: " + mAbsVolRetryTimes);
+ ProfileService.println(sb, "mSkipAmount: " + mSkipAmount);
+ }
+
// Do not modify without updating the HAL bt_rc.h files.
// match up with btrc_play_status_t enum of bt_rc.h
return Utils.getBytesFromAddress(device.getAddress());
}
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ }
+
private native static void classInitNative();
private native void initNative();
private native void cleanupNative();
private int mIdleTimeTotalMs;
private int mEnergyUsedTotalVoltAmpSecMicro;
+ private final ArrayList<ProfileService> mProfiles = new ArrayList<ProfileService>();
+
public static final String ACTION_LOAD_ADAPTER_PROPERTIES =
"com.android.bluetooth.btservice.action.LOAD_ADAPTER_PROPERTIES";
public static final String ACTION_SERVICE_STATE_CHANGED =
}
}
+ public void addProfile(ProfileService profile) {
+ synchronized (mProfiles) {
+ mProfiles.add(profile);
+ }
+ }
+
+ public void removeProfile(ProfileService profile) {
+ synchronized (mProfiles) {
+ mProfiles.remove(profile);
+ }
+ }
+
public void onProfileServiceStateChanged(String serviceName, int state) {
Message m = mHandler.obtainMessage(MESSAGE_PROFILE_SERVICE_STATE_CHANGED);
m.obj=serviceName;
if (service == null) return null;
return service.reportActivityInfo();
}
+
+ public String dump() {
+ AdapterService service = getService();
+ if (service == null) {
+ return "AdapterService is null";
+ }
+ return service.dump();
+ }
};
return info;
}
+ private String dump() {
+ StringBuilder sb = new StringBuilder();
+ synchronized (mProfiles) {
+ for (ProfileService profile : mProfiles) {
+ profile.dump(sb);
+ }
+ }
+ return sb.toString();
+ }
+
private static int convertScanModeToHal(int mode) {
switch (mode) {
case BluetoothAdapter.SCAN_MODE_NONE:
protected boolean mStartError=false;
private boolean mCleaningUp = false;
+ private AdapterService mAdapterService;
+
protected String getName() {
return getClass().getSimpleName();
}
super.onCreate();
mAdapter = BluetoothAdapter.getDefaultAdapter();
mBinder = initBinder();
+ mAdapterService = AdapterService.getAdapterService();
+ mAdapterService.addProfile(this);
}
public int onStartCommand(Intent intent, int flags, int startId) {
return super.onUnbind(intent);
}
+ // for dumpsys support
+ public void dump(StringBuilder sb) {
+ sb.append("Profile: " + mName + "\n");
+ }
+
+ // with indenting for subclasses
+ public static void println(StringBuilder sb, String s) {
+ sb.append(" ");
+ sb.append(s);
+ sb.append("\n");
+ }
+
@Override
public void onDestroy() {
if (DBG) log("Destroying service.");
+ mAdapterService.removeProfile(this);
if (mCleaningUp) {
if (DBG) log("Cleanup already started... Skipping cleanup()...");
} else {
protected void notifyProfileServiceStateChanged(int state) {
//Notify adapter service
- AdapterService sAdapter = AdapterService.getAdapterService();
- if (sAdapter!= null) {
- sAdapter.onProfileServiceStateChanged(getClass().getName(), state);
+ if (mAdapterService != null) {
+ mAdapterService.onProfileServiceStateChanged(getClass().getName(), state);
}
}
public void notifyProfileConnectionStateChanged(BluetoothDevice device,
int profileId, int newState, int prevState) {
- AdapterService svc = AdapterService.getAdapterService();
- if (svc != null) {
- svc.onProfileConnectionStateChanged(device, profileId, newState, prevState);
+ if (mAdapterService != null) {
+ mAdapterService.onProfileConnectionStateChanged(device, profileId, newState, prevState);
}
}
return uuids;
}
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ println(sb, "mAdvertisingServiceUuids:");
+ for (UUID uuid : mAdvertisingServiceUuids) {
+ println(sb, " " + uuid);
+ }
+ println(sb, "mOnFoundResults:");
+ for (ScanResult result : mOnFoundResults.values()) {
+ println(sb, " " + result);
+ }
+ println(sb, "mOnFoundResults:");
+ for (ServiceDeclaration declaration : mServiceDeclarations) {
+ println(sb, " " + declaration);
+ }
+ println(sb, "mMaxScanFilters: " + mMaxScanFilters);
+ }
+
/**************************************************************************
* GATT Test functions
*************************************************************************/
return healthDevices;
}
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ println(sb, "mHealthChannels:");
+ for (HealthChannel channel : mHealthChannels) {
+ println(sb, " " + channel);
+ }
+ println(sb, "mApps:");
+ for (BluetoothHealthAppConfiguration conf : mApps.keySet()) {
+ println(sb, " " + conf + " : " + mApps.get(conf));
+ }
+ println(sb, "mHealthDevices:");
+ for (BluetoothDevice device : mHealthDevices.keySet()) {
+ println(sb, " " + device + " : " + mHealthDevices.get(device));
+ }
+ }
+
private static class AppInfo {
private IBluetoothHealthCallback mCallback;
private BluetoothHealthDeathRecipient mRcpObj;
return true;
}
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ if (mStateMachine != null) {
+ mStateMachine.dump(sb);
+ }
+ }
}
import android.util.Log;
import com.android.bluetooth.Utils;
import com.android.bluetooth.btservice.AdapterService;
+import com.android.bluetooth.btservice.ProfileService;
import com.android.internal.util.IState;
import com.android.internal.util.State;
import com.android.internal.util.StateMachine;
}
}
+ public void dump(StringBuilder sb) {
+ ProfileService.println(sb, "mCurrentDevice: " + mCurrentDevice);
+ ProfileService.println(sb, "mTargetDevice: " + mTargetDevice);
+ ProfileService.println(sb, "mIncomingDevice: " + mIncomingDevice);
+ ProfileService.println(sb, "mActiveScoDevice: " + mActiveScoDevice);
+ ProfileService.println(sb, "mMultiDisconnectDevice: " + mMultiDisconnectDevice);
+ ProfileService.println(sb, "mVirtualCallStarted: " + mVirtualCallStarted);
+ ProfileService.println(sb, "mVoiceRecognitionStarted: " + mVoiceRecognitionStarted);
+ ProfileService.println(sb, "mWaitingForVoiceRecognition: " + mWaitingForVoiceRecognition);
+ ProfileService.println(sb, "StateMachine: " + this.toString());
+ ProfileService.println(sb, "mPhoneState: " + mPhoneState);
+ ProfileService.println(sb, "mAudioState: " + mAudioState);
+ }
+
private class Disconnected extends State {
@Override
public void enter() {
}
return mStateMachine.getCurrentAgFeatures();
}
+
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ if (mStateMachine != null) {
+ mStateMachine.dump(sb);
+ }
+ }
}
classInitNative();
}
+ public void dump(StringBuilder sb) {
+ ProfileService.println(sb, "mCurrentDevice: " + mCurrentDevice);
+ ProfileService.println(sb, "mAudioOn: " + mAudioOn);
+ ProfileService.println(sb, "mAudioState: " + mAudioState);
+ ProfileService.println(sb, "mAudioWbs: " + mAudioWbs);
+ ProfileService.println(sb, "mIndicatorNetworkState: " + mIndicatorNetworkState);
+ ProfileService.println(sb, "mIndicatorNetworkType: " + mIndicatorNetworkType);
+ ProfileService.println(sb, "mIndicatorNetworkSignal: " + mIndicatorNetworkSignal);
+ ProfileService.println(sb, "mIndicatorBatteryLevel: " + mIndicatorBatteryLevel);
+ ProfileService.println(sb, "mIndicatorCall: " + mIndicatorCall);
+ ProfileService.println(sb, "mIndicatorCallSetup: " + mIndicatorCallSetup);
+ ProfileService.println(sb, "mIndicatorCallHeld: " + mIndicatorCallHeld);
+ ProfileService.println(sb, "mVgsFromStack: " + mVgsFromStack);
+ ProfileService.println(sb, "mVgmFromStack: " + mVgmFromStack);
+ ProfileService.println(sb, "mRingtone: " + mRingtone);
+ ProfileService.println(sb, "mOperatorName: " + mOperatorName);
+ ProfileService.println(sb, "mSubscriberInfo: " + mSubscriberInfo);
+ ProfileService.println(sb, "mVoiceRecognitionActive: " + mVoiceRecognitionActive);
+ ProfileService.println(sb, "mInBandRingtone: " + mInBandRingtone);
+ ProfileService.println(sb, "mCalls:");
+ for (BluetoothHeadsetClientCall call : mCalls.values()) {
+ ProfileService.println(sb, " " + call);
+ }
+ ProfileService.println(sb, "mCallsUpdate:");
+ for (BluetoothHeadsetClientCall call : mCallsUpdate.values()) {
+ ProfileService.println(sb, " " + call);
+ }
+ }
+
private void clearPendingAction() {
mPendingAction = new Pair<Integer, Object>(NO_ACTION, 0);
}
}
}
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ println(sb, "mTargetDevice: " + mTargetDevice);
+ println(sb, "mInputDevices:");
+ for (BluetoothDevice device : mInputDevices.keySet()) {
+ println(sb, " " + device + " : " + mInputDevices.get(device));
+ }
+ }
+
// Constants matching Hal header file bt_hh.h
// bthh_connection_state_t
private final static int CONN_STATE_CONNECTED = 0;
return service.getPriority(device);
}
}
+
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ println(sb, "mRemoteDevice: " + mRemoteDevice);
+ println(sb, "sRemoteDeviceName: " + sRemoteDeviceName);
+ println(sb, "mState: " + mState);
+ println(sb, "mAppObserver: " + mAppObserver);
+ println(sb, "mIsWaitingAuthorization: " + mIsWaitingAuthorization);
+ println(sb, "mRemoveTimeoutMsg: " + mRemoveTimeoutMsg);
+ println(sb, "mPermission: " + mPermission);
+ println(sb, "mAccountChanged: " + mAccountChanged);
+ println(sb, "mBluetoothMnsObexClient: " + mBluetoothMnsObexClient);
+ println(sb, "mMasInstanceMap:");
+ for (BluetoothMapEmailSettingsItem key : mMasInstanceMap.keySet()) {
+ println(sb, " " + key + " : " + mMasInstanceMap.get(key));
+ }
+ println(sb, "mEnabledAccounts:");
+ for (BluetoothMapEmailSettingsItem account : mEnabledAccounts) {
+ println(sb, " " + account);
+ }
+ }
}
return panDevice.mState;
}
+ @Override
+ public void dump(StringBuilder sb) {
+ super.dump(sb);
+ println(sb, "mMaxPanDevices: " + mMaxPanDevices);
+ println(sb, "mPanIfName: " + mPanIfName);
+ println(sb, "mTetherOn: " + mTetherOn);
+ println(sb, "mPanDevices:");
+ for (BluetoothDevice device : mPanDevices.keySet()) {
+ println(sb, " " + device + " : " + mPanDevices.get(device));
+ }
+ println(sb, "mBluetoothIfaceAddresses:");
+ for (String address : mBluetoothIfaceAddresses) {
+ println(sb, " " + address);
+ }
+ }
+
private class BluetoothPanDevice {
private int mState;
private String mIfaceAddr;