diff --git a/app/src/main/java/com/kooritea/fcmfix/MainActivity.java b/app/src/main/java/com/kooritea/fcmfix/MainActivity.java index 279f5b7..e00c0ff 100644 --- a/app/src/main/java/com/kooritea/fcmfix/MainActivity.java +++ b/app/src/main/java/com/kooritea/fcmfix/MainActivity.java @@ -161,7 +161,15 @@ public void onItemClick(AdapterView arg0, View arg1, int position, long arg3) appListAdapter.notifyDataSetChanged(); } }); + this.initHeartbeatInterval(); + } + private void initHeartbeatInterval(){ + if(this.sharedPreferences.getString("heartbeatInterval","").equals("")){ + this.sharedPreferencesEditor.putString("heartbeatInterval","117000"); + this.sharedPreferencesEditor.commit(); + this.setWorldReadable(); + } } private void addAppInAllowList(String packageName){ diff --git a/app/src/main/java/com/kooritea/fcmfix/XposedMain.java b/app/src/main/java/com/kooritea/fcmfix/XposedMain.java index bc19f94..c569605 100644 --- a/app/src/main/java/com/kooritea/fcmfix/XposedMain.java +++ b/app/src/main/java/com/kooritea/fcmfix/XposedMain.java @@ -11,7 +11,7 @@ public class XposedMain implements IXposedHookLoadPackage { public void handleLoadPackage(final XC_LoadPackage.LoadPackageParam loadPackageParam) throws Throwable { if(loadPackageParam.packageName.equals("android")){ - XposedBridge.log("[fcmfix] com.android.server.am.ActivityManagerService"); + XposedBridge.log("[fcmfix] start hook com.android.server.am.ActivityManagerService"); new BroadcastFix(loadPackageParam); } if(loadPackageParam.packageName.equals("com.google.android.gms")){ diff --git a/app/src/main/java/com/kooritea/fcmfix/xposed/ReconnectManagerFix.java b/app/src/main/java/com/kooritea/fcmfix/xposed/ReconnectManagerFix.java index 1ee42af..c35a3d8 100644 --- a/app/src/main/java/com/kooritea/fcmfix/xposed/ReconnectManagerFix.java +++ b/app/src/main/java/com/kooritea/fcmfix/xposed/ReconnectManagerFix.java @@ -7,6 +7,7 @@ import android.content.IntentFilter; import android.os.SystemClock; +import java.util.HashSet; import java.util.Timer; import java.util.TimerTask; @@ -30,7 +31,14 @@ protected void beforeHookedMethod(final MethodHookParam param) throws Throwable // 修改心跳间隔 Intent intent = (Intent) XposedHelpers.getObjectField(param.thisObject,"e"); if("com.google.android.gms.gcm.HEARTBEAT_ALARM".equals(intent.getAction())){ - param.args[0] = 117000L; + String heartbeatIntervalString = getXSharedPreferences().getString("heartbeatInterval",""); + if(heartbeatIntervalString.equals("")){ + heartbeatIntervalString = "117000"; + } + long heartbeatInterval = new Long(heartbeatIntervalString).longValue(); + if(heartbeatInterval>5000L){ + param.args[0] = heartbeatInterval; + } } } @Override diff --git a/app/src/main/java/com/kooritea/fcmfix/xposed/XposedModule.java b/app/src/main/java/com/kooritea/fcmfix/xposed/XposedModule.java index 3e3bf1b..acc06f7 100644 --- a/app/src/main/java/com/kooritea/fcmfix/xposed/XposedModule.java +++ b/app/src/main/java/com/kooritea/fcmfix/xposed/XposedModule.java @@ -29,6 +29,11 @@ protected XSharedPreferences getXSharedPreferences(){ protected void printLog(String text){ Intent log = new Intent("com.kooritea.fcmfix.log"); log.putExtra("text",text); - AndroidAppHelper.currentApplication().getApplicationContext().sendBroadcast(log); + try{ + AndroidAppHelper.currentApplication().getApplicationContext().sendBroadcast(log); + }catch (Exception e){ + e.printStackTrace();; + } + } } diff --git a/app/src/main/res/layout/app_item.xml b/app/src/main/res/layout/app_item.xml index 08ec9f4..7a9b5d7 100644 --- a/app/src/main/res/layout/app_item.xml +++ b/app/src/main/res/layout/app_item.xml @@ -60,6 +60,8 @@ android:layout_height="match_parent" android:gravity="center" android:focusable="false" + android:clickable="false" + android:focusableInTouchMode="false" android:layoutDirection="rtl" /> \ No newline at end of file