GamingMode: Remove GamingModeStatusObserver
Change-Id: I747ee03f494bdbf343de87572404c454c00f479d
Signed-off-by: cjybyjk <cjybyjk@zjnu.edu.cn>
diff --git a/app/src/main/java/org/exthmui/game/services/GamingService.java b/app/src/main/java/org/exthmui/game/services/GamingService.java
index 8df2ff9..a27a1e0 100644
--- a/app/src/main/java/org/exthmui/game/services/GamingService.java
+++ b/app/src/main/java/org/exthmui/game/services/GamingService.java
@@ -87,8 +87,6 @@
private GamingPhoneStateListener mPhoneStateListener;
- private GamingModeStatusObserver mGamingModeStatusObserver;
-
private BroadcastReceiver mGamingModeOffReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -159,7 +157,6 @@
registerReceiver(mGamingModeOffReceiver, new IntentFilter(Constants.Broadcasts.SYS_BROADCAST_GAMING_MODE_OFF));
LocalBroadcastManager.getInstance(this).registerReceiver(mCallControlReceiver, new IntentFilter(Constants.Broadcasts.BROADCAST_CALL_CONTROL));
LocalBroadcastManager.getInstance(this).registerReceiver(mGamingActionReceiver, new IntentFilter(Constants.Broadcasts.BROADCAST_GAMING_ACTION));
- mGamingModeStatusObserver = new GamingModeStatusObserver(this, new Handler(Looper.getMainLooper()));
mPhoneStateListener = new GamingPhoneStateListener();
mTelephonyManager.listen(mPhoneStateListener, PhoneStateListener.LISTEN_CALL_STATE);
@@ -434,30 +431,4 @@
}
}
- private static class GamingModeStatusObserver extends ContentObserver {
-
- private static Uri mUriForIsGaming = Settings.System.getUriFor(Settings.System.GAMING_MODE_ACTIVE);
-
- private Service mService;
- private ContentResolver mResolver;
-
- public GamingModeStatusObserver(Service service, Handler handler) {
- super(handler);
- mService = service;
- mResolver = service.getContentResolver();
- mResolver.registerContentObserver(mUriForIsGaming, false, this);
-
- }
-
- @Override
- public void onChange(boolean selfChange, Uri uri) {
- super.onChange(selfChange, uri);
- if (mUriForIsGaming.equals(uri)) {
- if (Settings.System.getInt(mResolver, Settings.System.GAMING_MODE_ACTIVE, 0) == 0) {
- mResolver.unregisterContentObserver(this);
- mService.stopSelf();
- }
- }
- }
- }
}