only ever create one wake lock in rtpsessionactivity
This commit is contained in:
parent
c9f7e174f7
commit
609120c0d8
|
@ -1105,10 +1105,6 @@ public class NotificationService {
|
||||||
notify(FOREGROUND_NOTIFICATION_ID, notification);
|
notify(FOREGROUND_NOTIFICATION_ID, notification);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dismissForcedForegroundNotification() {
|
|
||||||
cancel(FOREGROUND_NOTIFICATION_ID);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void notify(String tag, int id, Notification notification) {
|
private void notify(String tag, int id, Notification notification) {
|
||||||
final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(mXmppConnectionService);
|
final NotificationManagerCompat notificationManager = NotificationManagerCompat.from(mXmppConnectionService);
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -1273,7 +1273,7 @@ public class XmppConnectionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean foregroundNotificationNeedsUpdatingWhenErrorStateChanges() {
|
public boolean foregroundNotificationNeedsUpdatingWhenErrorStateChanges() {
|
||||||
return !mForceForegroundService.get() && Compatibility.keepForegroundService(this) && hasEnabledAccounts();
|
return !mForceForegroundService.get() && ongoingCall.get() == null && Compatibility.keepForegroundService(this) && hasEnabledAccounts();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -115,7 +115,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
|
if (this.mProximityWakeLock == null) {
|
||||||
this.mProximityWakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, PROXIMITY_WAKE_LOCK_TAG);
|
this.mProximityWakeLock = powerManager.newWakeLock(PowerManager.PROXIMITY_SCREEN_OFF_WAKE_LOCK, PROXIMITY_WAKE_LOCK_TAG);
|
||||||
|
}
|
||||||
if (!this.mProximityWakeLock.isHeld()) {
|
if (!this.mProximityWakeLock.isHeld()) {
|
||||||
Log.d(Config.LOGTAG, "acquiring wake lock");
|
Log.d(Config.LOGTAG, "acquiring wake lock");
|
||||||
this.mProximityWakeLock.acquire();
|
this.mProximityWakeLock.acquire();
|
||||||
|
@ -139,6 +141,7 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
@Override
|
@Override
|
||||||
public void onNewIntent(final Intent intent) {
|
public void onNewIntent(final Intent intent) {
|
||||||
super.onNewIntent(intent);
|
super.onNewIntent(intent);
|
||||||
|
//TODO. deal with 'pending intent' in case background service isn’t here yet.
|
||||||
final Account account = extractAccount(intent);
|
final Account account = extractAccount(intent);
|
||||||
final Jid with = Jid.of(intent.getStringExtra(EXTRA_WITH));
|
final Jid with = Jid.of(intent.getStringExtra(EXTRA_WITH));
|
||||||
final String sessionId = intent.getStringExtra(EXTRA_SESSION_ID);
|
final String sessionId = intent.getStringExtra(EXTRA_SESSION_ID);
|
||||||
|
@ -211,10 +214,8 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
if (!isChangingConfigurations()) {
|
|
||||||
releaseWakeLock();
|
releaseWakeLock();
|
||||||
//TODO maybe we want to finish if call had ended
|
//TODO maybe we want to finish if call had ended
|
||||||
}
|
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue