Messaging: Further code improvements

* Remove redundant casts
* getParcelable(ArrayList|Exra) without class argument is deprecated
* ViewPager.setOnPageChangeListener -> addOnPageChangeListener
* RecyclerView.setOnScrollListener -> addOnScrollListener
* Remove unused initializations
* Remove unused code

Change-Id: I21beb6c90c675a4f2cfd7e3d5ebbd18b745f5911
This commit is contained in:
Michael W
2025-01-01 13:54:07 +01:00
parent 47f5533a73
commit b2f5e3190e
110 changed files with 289 additions and 561 deletions

View File

@@ -186,7 +186,7 @@ public class NotificationPlayer implements OnCompletionListener {
@Override
public void run() {
while (true) {
Command cmd = null;
Command cmd;
synchronized (mCmdQueue) {
if (mDebug) {
@@ -327,31 +327,6 @@ public class NotificationPlayer implements OnCompletionListener {
}
}
/**
* We want to hold a wake lock while we do the prepare and play. The stop probably is
* optional, but it won't hurt to have it too. The problem is that if you start a sound
* while you're holding a wake lock (e.g. an alarm starting a notification), you want the
* sound to play, but if the CPU turns off before mThread gets to work, it won't. The
* simplest way to deal with this is to make it so there is a wake lock held while the
* thread is starting or running. You're going to need the WAKE_LOCK permission if you're
* going to call this.
*
* This must be called before the first time play is called.
*
* @hide
*/
public void setUsesWakeLock() {
if (mWakeLock != null || mThread != null) {
// if either of these has happened, we've already played something.
// and our releases will be out of sync.
throw new RuntimeException("assertion failed mWakeLock=" + mWakeLock
+ " mThread=" + mThread);
}
final PowerManager pm = (PowerManager) Factory.get().getApplicationContext()
.getSystemService(Context.POWER_SERVICE);
mWakeLock = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, mTag);
}
private void acquireWakeLock() {
if (mWakeLock != null) {
mWakeLock.acquire();