diff options
4 files changed, 38 insertions, 30 deletions
diff --git a/core/res/res/layout/status_bar_latest_event_content_large_icon.xml b/core/res/res/layout/status_bar_latest_event_content_large_icon.xml index ac4d1e43f7c4..f3f19574a636 100644 --- a/core/res/res/layout/status_bar_latest_event_content_large_icon.xml +++ b/core/res/res/layout/status_bar_latest_event_content_large_icon.xml @@ -4,8 +4,8 @@ android:layout_height="wrap_content" android:layout_gravity="center" android:orientation="vertical" - android:paddingLeft="8dp" - android:paddingRight="8dp" + android:paddingLeft="12dp" + android:paddingRight="12dp" > <TextView android:id="@+id/title" android:textAppearance="@style/TextAppearance.StatusBar.EventContent.Title" diff --git a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java index 3dae5ad4f104..886997c43ac8 100644 --- a/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java +++ b/policy/src/com/android/internal/policy/impl/KeyguardViewMediator.java @@ -31,9 +31,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.media.AudioManager; -import android.media.Ringtone; -import android.media.RingtoneManager; -import android.net.Uri; +import android.media.SoundPool; import android.os.Handler; import android.os.LocalPowerManager; import android.os.Message; @@ -253,6 +251,11 @@ public class KeyguardViewMediator implements KeyguardViewCallback, private boolean mWaitingUntilKeyguardVisible = false; private LockPatternUtils mLockPatternUtils; + private SoundPool mLockSounds; + private int mLockSoundId; + private int mUnlockSoundId; + private int mLockSoundStreamId; + public KeyguardViewMediator(Context context, PhoneWindowManager callback, LocalPowerManager powerManager) { mContext = context; @@ -298,6 +301,22 @@ public class KeyguardViewMediator implements KeyguardViewCallback, final ContentResolver cr = mContext.getContentResolver(); mShowLockIcon = (Settings.System.getInt(cr, "show_status_bar_lock", 0) == 1); + + mLockSounds = new SoundPool(1, AudioManager.STREAM_SYSTEM, 0); + String soundPath = Settings.System.getString(cr, Settings.System.LOCK_SOUND); + if (soundPath != null) { + mLockSoundId = mLockSounds.load(soundPath, 1); + } + if (soundPath == null || mLockSoundId == 0) { + if (DEBUG) Log.d(TAG, "failed to load sound from " + soundPath); + } + soundPath = Settings.System.getString(cr, Settings.System.UNLOCK_SOUND); + if (soundPath != null) { + mUnlockSoundId = mLockSounds.load(soundPath, 1); + } + if (soundPath == null || mUnlockSoundId == 0) { + if (DEBUG) Log.d(TAG, "failed to load sound from " + soundPath); + } } /** @@ -1044,29 +1063,11 @@ public class KeyguardViewMediator implements KeyguardViewCallback, final ContentResolver cr = mContext.getContentResolver(); if (Settings.System.getInt(cr, Settings.System.LOCKSCREEN_SOUNDS_ENABLED, 1) == 1) { - final String whichSound = locked - ? Settings.System.LOCK_SOUND - : Settings.System.UNLOCK_SOUND; - final String soundPath = Settings.System.getString(cr, whichSound); - if (soundPath != null) { - final Uri soundUri = Uri.parse("file://" + soundPath); - if (soundUri != null) { - final Ringtone sfx = RingtoneManager.getRingtone(mContext, soundUri); - if (sfx != null) { - sfx.setStreamType(AudioManager.STREAM_SYSTEM); - sfx.setWakeMode(mContext, PowerManager.PARTIAL_WAKE_LOCK); - sfx.play(); - } else { - if (DEBUG) Log.d(TAG, "playSounds: failed to load ringtone from uri: " - + soundUri); - } - } else { - if (DEBUG) Log.d(TAG, "playSounds: could not parse Uri: " + soundPath); - } - } else { - if (DEBUG) Log.d(TAG, "playSounds: whichSound = " + whichSound - + "; soundPath was null"); - } + final int whichSound = locked + ? mLockSoundId + : mUnlockSoundId; + mLockSounds.stop(mLockSoundStreamId); + mLockSoundStreamId = mLockSounds.play(whichSound, 1.0f, 1.0f, 1, 0, 1.0f); } } diff --git a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java index 2c7f86d71844..f970ff3787be 100644 --- a/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java +++ b/policy/src/com/android/internal/policy/impl/LockPatternKeyguardView.java @@ -996,10 +996,14 @@ public class LockPatternKeyguardView extends KeyguardViewBase implements Handler public boolean handleMessage(Message msg) { switch (msg.what) { case MSG_SHOW_FACELOCK_AREA_VIEW: - mFaceLockAreaView.setVisibility(View.VISIBLE); + if (mFaceLockAreaView != null) { + mFaceLockAreaView.setVisibility(View.VISIBLE); + } break; case MSG_HIDE_FACELOCK_AREA_VIEW: - mFaceLockAreaView.setVisibility(View.GONE); + if (mFaceLockAreaView != null) { + mFaceLockAreaView.setVisibility(View.GONE); + } break; default: Log.w(TAG, "Unhandled message"); diff --git a/services/input/EventHub.cpp b/services/input/EventHub.cpp index 80ee28ee6ce2..790b395c7b41 100644 --- a/services/input/EventHub.cpp +++ b/services/input/EventHub.cpp @@ -639,6 +639,8 @@ size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSiz sizeof(struct input_event) * capacity); if (readSize == 0 || (readSize < 0 && errno == ENODEV)) { // Device was removed before INotify noticed. + LOGW("could not get event, removed? (fd: %d size: %d bufferSize: %d capacity: %d errno: %d)\n", + device->fd, readSize, bufferSize, capacity, errno); deviceChanged = true; closeDeviceLocked(device); } else if (readSize < 0) { @@ -1254,6 +1256,7 @@ status_t EventHub::readNotifyLocked() { if(event->mask & IN_CREATE) { openDeviceLocked(devname); } else { + LOGI("Removing device '%s' due to inotify event\n", devname); closeDeviceByPathLocked(devname); } } |