Loading scripts/telecom_testing.sh +13 −3 Original line number Original line Diff line number Diff line Loading @@ -10,6 +10,7 @@ _lite_test_general() { running tests (mmma). running tests (mmma). -e Run code coverage. Coverage will be output into the coverage/ -e Run code coverage. Coverage will be output into the coverage/ directory in the repo root. directory in the repo root. -g Run build commands with USE_GOMA=true -h This help message. -h This help message. " " Loading @@ -20,8 +21,9 @@ _lite_test_general() { local installwdep=false local installwdep=false local debug=false local debug=false local coverage=false local coverage=false local goma=false while getopts "c:p:hadie" opt; do while getopts "c:p:hadieg" opt; do case "$opt" in case "$opt" in h) h) echo "$usage" echo "$usage" Loading @@ -40,6 +42,8 @@ _lite_test_general() { installwdep=true;; installwdep=true;; e) e) coverage=true;; coverage=true;; g) goma=true;; p) p) project=$OPTARG;; project=$OPTARG;; esac esac Loading Loading @@ -67,6 +71,8 @@ _lite_test_general() { if [ $install = true ] ; then if [ $install = true ] ; then local olddir=$(pwd) local olddir=$(pwd) local emma_opt= local emma_opt= local goma_opt= cd $T cd $T # Build and exit script early if build fails # Build and exit script early if build fails Loading @@ -76,10 +82,14 @@ _lite_test_general() { emma_opt="EMMA_INSTRUMENT=false" emma_opt="EMMA_INSTRUMENT=false" fi fi if [ $goma = true ] ; then goma_opt="USE_GOMA=true" fi if [ $installwdep = true ] ; then if [ $installwdep = true ] ; then (export ${emma_opt}; mmma -j40 "$build_dir") (export ${emma_opt}; mmma ${goma_opt} -j40 "$build_dir") else else (export ${emma_opt}; mmm "$build_dir") (export ${emma_opt}; mmm ${goma_opt} "$build_dir") fi fi if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then echo "Make failed! try using -a instead of -i if building with coverage" echo "Make failed! try using -a instead of -i if building with coverage" Loading src/com/android/server/telecom/CallsManager.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -305,7 +305,8 @@ public class CallsManager extends Call.ListenerBase Timeouts.Adapter timeoutsAdapter, Timeouts.Adapter timeoutsAdapter, AsyncRingtonePlayer asyncRingtonePlayer, AsyncRingtonePlayer asyncRingtonePlayer, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, EmergencyCallHelper emergencyCallHelper) { EmergencyCallHelper emergencyCallHelper, InCallTonePlayer.ToneGeneratorFactory toneGeneratorFactory) { mContext = context; mContext = context; mLock = lock; mLock = lock; mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter; mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter; Loading Loading @@ -345,7 +346,7 @@ public class CallsManager extends Call.ListenerBase mDockManager); mDockManager); InCallTonePlayer.Factory playerFactory = new InCallTonePlayer.Factory( InCallTonePlayer.Factory playerFactory = new InCallTonePlayer.Factory( callAudioRoutePeripheralAdapter, lock); callAudioRoutePeripheralAdapter, lock, toneGeneratorFactory); SystemSettingsUtil systemSettingsUtil = new SystemSettingsUtil(); SystemSettingsUtil systemSettingsUtil = new SystemSettingsUtil(); RingtoneFactory ringtoneFactory = new RingtoneFactory(this, context); RingtoneFactory ringtoneFactory = new RingtoneFactory(this, context); Loading src/com/android/server/telecom/InCallTonePlayer.java +14 −4 Original line number Original line Diff line number Diff line Loading @@ -40,11 +40,13 @@ public class InCallTonePlayer extends Thread { private CallAudioManager mCallAudioManager; private CallAudioManager mCallAudioManager; private final CallAudioRoutePeripheralAdapter mCallAudioRoutePeripheralAdapter; private final CallAudioRoutePeripheralAdapter mCallAudioRoutePeripheralAdapter; private final TelecomSystem.SyncRoot mLock; private final TelecomSystem.SyncRoot mLock; private final ToneGeneratorFactory mToneGeneratorFactory; Factory(CallAudioRoutePeripheralAdapter callAudioRoutePeripheralAdapter, Factory(CallAudioRoutePeripheralAdapter callAudioRoutePeripheralAdapter, TelecomSystem.SyncRoot lock) { TelecomSystem.SyncRoot lock, ToneGeneratorFactory toneGeneratorFactory) { mCallAudioRoutePeripheralAdapter = callAudioRoutePeripheralAdapter; mCallAudioRoutePeripheralAdapter = callAudioRoutePeripheralAdapter; mLock = lock; mLock = lock; mToneGeneratorFactory = toneGeneratorFactory; } } public void setCallAudioManager(CallAudioManager callAudioManager) { public void setCallAudioManager(CallAudioManager callAudioManager) { Loading @@ -53,10 +55,14 @@ public class InCallTonePlayer extends Thread { public InCallTonePlayer createPlayer(int tone) { public InCallTonePlayer createPlayer(int tone) { return new InCallTonePlayer(tone, mCallAudioManager, return new InCallTonePlayer(tone, mCallAudioManager, mCallAudioRoutePeripheralAdapter, mLock); mCallAudioRoutePeripheralAdapter, mLock, mToneGeneratorFactory); } } } } public interface ToneGeneratorFactory { ToneGenerator get (int streamType, int volume); } // The possible tones that we can play. // The possible tones that we can play. public static final int TONE_INVALID = 0; public static final int TONE_INVALID = 0; public static final int TONE_BUSY = 1; public static final int TONE_BUSY = 1; Loading Loading @@ -111,6 +117,8 @@ public class InCallTonePlayer extends Thread { private Session mSession; private Session mSession; private final Object mSessionLock = new Object(); private final Object mSessionLock = new Object(); private final ToneGeneratorFactory mToneGenerator; /** /** * Initializes the tone player. Private; use the {@link Factory} to create tone players. * Initializes the tone player. Private; use the {@link Factory} to create tone players. * * Loading @@ -120,12 +128,14 @@ public class InCallTonePlayer extends Thread { int toneId, int toneId, CallAudioManager callAudioManager, CallAudioManager callAudioManager, CallAudioRoutePeripheralAdapter callAudioRoutePeripheralAdapter, CallAudioRoutePeripheralAdapter callAudioRoutePeripheralAdapter, TelecomSystem.SyncRoot lock) { TelecomSystem.SyncRoot lock, ToneGeneratorFactory toneGeneratorFactory) { mState = STATE_OFF; mState = STATE_OFF; mToneId = toneId; mToneId = toneId; mCallAudioManager = callAudioManager; mCallAudioManager = callAudioManager; mCallAudioRoutePeripheralAdapter = callAudioRoutePeripheralAdapter; mCallAudioRoutePeripheralAdapter = callAudioRoutePeripheralAdapter; mLock = lock; mLock = lock; mToneGenerator = toneGeneratorFactory; } } /** {@inheritDoc} */ /** {@inheritDoc} */ Loading Loading @@ -227,7 +237,7 @@ public class InCallTonePlayer extends Thread { // signal, and is not as important. // signal, and is not as important. try { try { Log.v(this, "Creating generator"); Log.v(this, "Creating generator"); toneGenerator = new ToneGenerator(stream, toneVolume); toneGenerator = mToneGenerator.get(stream, toneVolume); } catch (RuntimeException e) { } catch (RuntimeException e) { Log.w(this, "Failed to create ToneGenerator.", e); Log.w(this, "Failed to create ToneGenerator.", e); return; return; Loading src/com/android/server/telecom/TelecomSystem.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -189,7 +189,8 @@ public class TelecomSystem { Timeouts.Adapter timeoutsAdapter, Timeouts.Adapter timeoutsAdapter, AsyncRingtonePlayer asyncRingtonePlayer, AsyncRingtonePlayer asyncRingtonePlayer, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, IncomingCallNotifier incomingCallNotifier) { IncomingCallNotifier incomingCallNotifier, InCallTonePlayer.ToneGeneratorFactory toneGeneratorFactory) { mContext = context.getApplicationContext(); mContext = context.getApplicationContext(); LogUtils.initLogging(mContext); LogUtils.initLogging(mContext); DefaultDialerManagerAdapter defaultDialerAdapter = DefaultDialerManagerAdapter defaultDialerAdapter = Loading Loading @@ -253,7 +254,8 @@ public class TelecomSystem { timeoutsAdapter, timeoutsAdapter, asyncRingtonePlayer, asyncRingtonePlayer, phoneNumberUtilsAdapter, phoneNumberUtilsAdapter, emergencyCallHelper); emergencyCallHelper, toneGeneratorFactory); mIncomingCallNotifier = incomingCallNotifier; mIncomingCallNotifier = incomingCallNotifier; incomingCallNotifier.setCallsManagerProxy(new IncomingCallNotifier.CallsManagerProxy() { incomingCallNotifier.setCallsManagerProxy(new IncomingCallNotifier.CallsManagerProxy() { Loading src/com/android/server/telecom/components/TelecomService.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.media.IAudioService; import android.media.IAudioService; import android.media.ToneGenerator; import android.os.IBinder; import android.os.IBinder; import android.os.PowerManager; import android.os.PowerManager; import android.os.ServiceManager; import android.os.ServiceManager; Loading @@ -35,6 +36,7 @@ import com.android.server.telecom.CallsManager; import com.android.server.telecom.DefaultDialerCache; import com.android.server.telecom.DefaultDialerCache; import com.android.server.telecom.HeadsetMediaButton; import com.android.server.telecom.HeadsetMediaButton; import com.android.server.telecom.HeadsetMediaButtonFactory; import com.android.server.telecom.HeadsetMediaButtonFactory; import com.android.server.telecom.InCallTonePlayer; import com.android.server.telecom.InCallWakeLockControllerFactory; import com.android.server.telecom.InCallWakeLockControllerFactory; import com.android.server.telecom.CallAudioManager; import com.android.server.telecom.CallAudioManager; import com.android.server.telecom.PhoneAccountRegistrar; import com.android.server.telecom.PhoneAccountRegistrar; Loading Loading @@ -158,7 +160,8 @@ public class TelecomService extends Service implements TelecomSystem.Component { new Timeouts.Adapter(), new Timeouts.Adapter(), new AsyncRingtonePlayer(), new AsyncRingtonePlayer(), new PhoneNumberUtilsAdapterImpl(), new PhoneNumberUtilsAdapterImpl(), new IncomingCallNotifier(context) new IncomingCallNotifier(context), ToneGenerator::new )); )); } } if (BluetoothAdapter.getDefaultAdapter() != null) { if (BluetoothAdapter.getDefaultAdapter() != null) { Loading Loading
scripts/telecom_testing.sh +13 −3 Original line number Original line Diff line number Diff line Loading @@ -10,6 +10,7 @@ _lite_test_general() { running tests (mmma). running tests (mmma). -e Run code coverage. Coverage will be output into the coverage/ -e Run code coverage. Coverage will be output into the coverage/ directory in the repo root. directory in the repo root. -g Run build commands with USE_GOMA=true -h This help message. -h This help message. " " Loading @@ -20,8 +21,9 @@ _lite_test_general() { local installwdep=false local installwdep=false local debug=false local debug=false local coverage=false local coverage=false local goma=false while getopts "c:p:hadie" opt; do while getopts "c:p:hadieg" opt; do case "$opt" in case "$opt" in h) h) echo "$usage" echo "$usage" Loading @@ -40,6 +42,8 @@ _lite_test_general() { installwdep=true;; installwdep=true;; e) e) coverage=true;; coverage=true;; g) goma=true;; p) p) project=$OPTARG;; project=$OPTARG;; esac esac Loading Loading @@ -67,6 +71,8 @@ _lite_test_general() { if [ $install = true ] ; then if [ $install = true ] ; then local olddir=$(pwd) local olddir=$(pwd) local emma_opt= local emma_opt= local goma_opt= cd $T cd $T # Build and exit script early if build fails # Build and exit script early if build fails Loading @@ -76,10 +82,14 @@ _lite_test_general() { emma_opt="EMMA_INSTRUMENT=false" emma_opt="EMMA_INSTRUMENT=false" fi fi if [ $goma = true ] ; then goma_opt="USE_GOMA=true" fi if [ $installwdep = true ] ; then if [ $installwdep = true ] ; then (export ${emma_opt}; mmma -j40 "$build_dir") (export ${emma_opt}; mmma ${goma_opt} -j40 "$build_dir") else else (export ${emma_opt}; mmm "$build_dir") (export ${emma_opt}; mmm ${goma_opt} "$build_dir") fi fi if [ $? -ne 0 ] ; then if [ $? -ne 0 ] ; then echo "Make failed! try using -a instead of -i if building with coverage" echo "Make failed! try using -a instead of -i if building with coverage" Loading
src/com/android/server/telecom/CallsManager.java +3 −2 Original line number Original line Diff line number Diff line Loading @@ -305,7 +305,8 @@ public class CallsManager extends Call.ListenerBase Timeouts.Adapter timeoutsAdapter, Timeouts.Adapter timeoutsAdapter, AsyncRingtonePlayer asyncRingtonePlayer, AsyncRingtonePlayer asyncRingtonePlayer, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, EmergencyCallHelper emergencyCallHelper) { EmergencyCallHelper emergencyCallHelper, InCallTonePlayer.ToneGeneratorFactory toneGeneratorFactory) { mContext = context; mContext = context; mLock = lock; mLock = lock; mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter; mPhoneNumberUtilsAdapter = phoneNumberUtilsAdapter; Loading Loading @@ -345,7 +346,7 @@ public class CallsManager extends Call.ListenerBase mDockManager); mDockManager); InCallTonePlayer.Factory playerFactory = new InCallTonePlayer.Factory( InCallTonePlayer.Factory playerFactory = new InCallTonePlayer.Factory( callAudioRoutePeripheralAdapter, lock); callAudioRoutePeripheralAdapter, lock, toneGeneratorFactory); SystemSettingsUtil systemSettingsUtil = new SystemSettingsUtil(); SystemSettingsUtil systemSettingsUtil = new SystemSettingsUtil(); RingtoneFactory ringtoneFactory = new RingtoneFactory(this, context); RingtoneFactory ringtoneFactory = new RingtoneFactory(this, context); Loading
src/com/android/server/telecom/InCallTonePlayer.java +14 −4 Original line number Original line Diff line number Diff line Loading @@ -40,11 +40,13 @@ public class InCallTonePlayer extends Thread { private CallAudioManager mCallAudioManager; private CallAudioManager mCallAudioManager; private final CallAudioRoutePeripheralAdapter mCallAudioRoutePeripheralAdapter; private final CallAudioRoutePeripheralAdapter mCallAudioRoutePeripheralAdapter; private final TelecomSystem.SyncRoot mLock; private final TelecomSystem.SyncRoot mLock; private final ToneGeneratorFactory mToneGeneratorFactory; Factory(CallAudioRoutePeripheralAdapter callAudioRoutePeripheralAdapter, Factory(CallAudioRoutePeripheralAdapter callAudioRoutePeripheralAdapter, TelecomSystem.SyncRoot lock) { TelecomSystem.SyncRoot lock, ToneGeneratorFactory toneGeneratorFactory) { mCallAudioRoutePeripheralAdapter = callAudioRoutePeripheralAdapter; mCallAudioRoutePeripheralAdapter = callAudioRoutePeripheralAdapter; mLock = lock; mLock = lock; mToneGeneratorFactory = toneGeneratorFactory; } } public void setCallAudioManager(CallAudioManager callAudioManager) { public void setCallAudioManager(CallAudioManager callAudioManager) { Loading @@ -53,10 +55,14 @@ public class InCallTonePlayer extends Thread { public InCallTonePlayer createPlayer(int tone) { public InCallTonePlayer createPlayer(int tone) { return new InCallTonePlayer(tone, mCallAudioManager, return new InCallTonePlayer(tone, mCallAudioManager, mCallAudioRoutePeripheralAdapter, mLock); mCallAudioRoutePeripheralAdapter, mLock, mToneGeneratorFactory); } } } } public interface ToneGeneratorFactory { ToneGenerator get (int streamType, int volume); } // The possible tones that we can play. // The possible tones that we can play. public static final int TONE_INVALID = 0; public static final int TONE_INVALID = 0; public static final int TONE_BUSY = 1; public static final int TONE_BUSY = 1; Loading Loading @@ -111,6 +117,8 @@ public class InCallTonePlayer extends Thread { private Session mSession; private Session mSession; private final Object mSessionLock = new Object(); private final Object mSessionLock = new Object(); private final ToneGeneratorFactory mToneGenerator; /** /** * Initializes the tone player. Private; use the {@link Factory} to create tone players. * Initializes the tone player. Private; use the {@link Factory} to create tone players. * * Loading @@ -120,12 +128,14 @@ public class InCallTonePlayer extends Thread { int toneId, int toneId, CallAudioManager callAudioManager, CallAudioManager callAudioManager, CallAudioRoutePeripheralAdapter callAudioRoutePeripheralAdapter, CallAudioRoutePeripheralAdapter callAudioRoutePeripheralAdapter, TelecomSystem.SyncRoot lock) { TelecomSystem.SyncRoot lock, ToneGeneratorFactory toneGeneratorFactory) { mState = STATE_OFF; mState = STATE_OFF; mToneId = toneId; mToneId = toneId; mCallAudioManager = callAudioManager; mCallAudioManager = callAudioManager; mCallAudioRoutePeripheralAdapter = callAudioRoutePeripheralAdapter; mCallAudioRoutePeripheralAdapter = callAudioRoutePeripheralAdapter; mLock = lock; mLock = lock; mToneGenerator = toneGeneratorFactory; } } /** {@inheritDoc} */ /** {@inheritDoc} */ Loading Loading @@ -227,7 +237,7 @@ public class InCallTonePlayer extends Thread { // signal, and is not as important. // signal, and is not as important. try { try { Log.v(this, "Creating generator"); Log.v(this, "Creating generator"); toneGenerator = new ToneGenerator(stream, toneVolume); toneGenerator = mToneGenerator.get(stream, toneVolume); } catch (RuntimeException e) { } catch (RuntimeException e) { Log.w(this, "Failed to create ToneGenerator.", e); Log.w(this, "Failed to create ToneGenerator.", e); return; return; Loading
src/com/android/server/telecom/TelecomSystem.java +4 −2 Original line number Original line Diff line number Diff line Loading @@ -189,7 +189,8 @@ public class TelecomSystem { Timeouts.Adapter timeoutsAdapter, Timeouts.Adapter timeoutsAdapter, AsyncRingtonePlayer asyncRingtonePlayer, AsyncRingtonePlayer asyncRingtonePlayer, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, PhoneNumberUtilsAdapter phoneNumberUtilsAdapter, IncomingCallNotifier incomingCallNotifier) { IncomingCallNotifier incomingCallNotifier, InCallTonePlayer.ToneGeneratorFactory toneGeneratorFactory) { mContext = context.getApplicationContext(); mContext = context.getApplicationContext(); LogUtils.initLogging(mContext); LogUtils.initLogging(mContext); DefaultDialerManagerAdapter defaultDialerAdapter = DefaultDialerManagerAdapter defaultDialerAdapter = Loading Loading @@ -253,7 +254,8 @@ public class TelecomSystem { timeoutsAdapter, timeoutsAdapter, asyncRingtonePlayer, asyncRingtonePlayer, phoneNumberUtilsAdapter, phoneNumberUtilsAdapter, emergencyCallHelper); emergencyCallHelper, toneGeneratorFactory); mIncomingCallNotifier = incomingCallNotifier; mIncomingCallNotifier = incomingCallNotifier; incomingCallNotifier.setCallsManagerProxy(new IncomingCallNotifier.CallsManagerProxy() { incomingCallNotifier.setCallsManagerProxy(new IncomingCallNotifier.CallsManagerProxy() { Loading
src/com/android/server/telecom/components/TelecomService.java +5 −2 Original line number Original line Diff line number Diff line Loading @@ -21,6 +21,7 @@ import android.bluetooth.BluetoothAdapter; import android.content.Context; import android.content.Context; import android.content.Intent; import android.content.Intent; import android.media.IAudioService; import android.media.IAudioService; import android.media.ToneGenerator; import android.os.IBinder; import android.os.IBinder; import android.os.PowerManager; import android.os.PowerManager; import android.os.ServiceManager; import android.os.ServiceManager; Loading @@ -35,6 +36,7 @@ import com.android.server.telecom.CallsManager; import com.android.server.telecom.DefaultDialerCache; import com.android.server.telecom.DefaultDialerCache; import com.android.server.telecom.HeadsetMediaButton; import com.android.server.telecom.HeadsetMediaButton; import com.android.server.telecom.HeadsetMediaButtonFactory; import com.android.server.telecom.HeadsetMediaButtonFactory; import com.android.server.telecom.InCallTonePlayer; import com.android.server.telecom.InCallWakeLockControllerFactory; import com.android.server.telecom.InCallWakeLockControllerFactory; import com.android.server.telecom.CallAudioManager; import com.android.server.telecom.CallAudioManager; import com.android.server.telecom.PhoneAccountRegistrar; import com.android.server.telecom.PhoneAccountRegistrar; Loading Loading @@ -158,7 +160,8 @@ public class TelecomService extends Service implements TelecomSystem.Component { new Timeouts.Adapter(), new Timeouts.Adapter(), new AsyncRingtonePlayer(), new AsyncRingtonePlayer(), new PhoneNumberUtilsAdapterImpl(), new PhoneNumberUtilsAdapterImpl(), new IncomingCallNotifier(context) new IncomingCallNotifier(context), ToneGenerator::new )); )); } } if (BluetoothAdapter.getDefaultAdapter() != null) { if (BluetoothAdapter.getDefaultAdapter() != null) { Loading