import android.os.Vibrator;
import android.provider.Settings;
import android.provider.Settings.System;
-import android.speech.RecognizerIntent;
-import android.telephony.PhoneStateListener;
-import android.telephony.TelephonyManager;
+import android.telecom.TelecomManager;
import android.text.TextUtils;
import android.util.Log;
+import android.util.MathUtils;
+import android.util.Slog;
import android.view.KeyEvent;
import android.view.Surface;
-import android.view.VolumePanel;
import android.view.WindowManager;
+import android.view.accessibility.AccessibilityManager;
+ import android.view.OrientationEventListener;
import com.android.internal.telephony.ITelephony;
import com.android.internal.util.XmlUtils;
newIntent.putExtra(AudioManager.EXTRA_SCO_AUDIO_STATE, scoAudioState);
sendStickyBroadcastToAll(newIntent);
}
- } else if (action.equals(Intent.ACTION_BOOT_COMPLETED)) {
- mBootCompleted = true;
- sendMsg(mAudioHandler, MSG_LOAD_SOUND_EFFECTS, SENDMSG_QUEUE,
- 0, 0, null, 0);
-
- mKeyguardManager =
- (KeyguardManager) mContext.getSystemService(Context.KEYGUARD_SERVICE);
- mScoConnectionState = AudioManager.SCO_AUDIO_STATE_ERROR;
- resetBluetoothSco();
- getBluetoothHeadset();
- //FIXME: this is to maintain compatibility with deprecated intent
- // AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED. Remove when appropriate.
- Intent newIntent = new Intent(AudioManager.ACTION_SCO_AUDIO_STATE_CHANGED);
- newIntent.putExtra(AudioManager.EXTRA_SCO_AUDIO_STATE,
- AudioManager.SCO_AUDIO_STATE_DISCONNECTED);
- sendStickyBroadcastToAll(newIntent);
-
- BluetoothAdapter adapter = BluetoothAdapter.getDefaultAdapter();
- if (adapter != null) {
- adapter.getProfileProxy(mContext, mBluetoothProfileServiceListener,
- BluetoothProfile.A2DP);
- }
-
- sendMsg(mAudioHandler,
- MSG_CONFIGURE_SAFE_MEDIA_VOLUME_FORCED,
- SENDMSG_REPLACE,
- 0,
- 0,
- null,
- SAFE_VOLUME_CONFIGURE_TIMEOUT_MS);
} else if (action.equals(Intent.ACTION_SCREEN_ON)) {
+ if (mMonitorRotation) {
+ mOrientationListener.onOrientationChanged(0); //argument is ignored anyway
+ mOrientationListener.enable();
+ }
AudioSystem.setParameters("screen_state=on");
} else if (action.equals(Intent.ACTION_SCREEN_OFF)) {
+ if (mMonitorRotation) {
+ //reduce wakeups (save current) by only listening when display is on
+ mOrientationListener.disable();
+ }
AudioSystem.setParameters("screen_state=off");
} else if (action.equals(Intent.ACTION_CONFIGURATION_CHANGED)) {
handleConfigurationChanged(context);