diff --git a/app/src/main/java/io/github/chipppppppppp/lime/Main.java b/app/src/main/java/io/github/chipppppppppp/lime/Main.java index dd251444..d3ba8d36 100644 --- a/app/src/main/java/io/github/chipppppppppp/lime/Main.java +++ b/app/src/main/java/io/github/chipppppppppp/lime/Main.java @@ -6,6 +6,7 @@ import android.app.Application; import android.app.Notification; import android.app.AlertDialog; +import android.content.ContentResolver; import android.content.Context; import android.content.DialogInterface; import android.content.Intent; @@ -14,6 +15,7 @@ import android.graphics.Canvas; import android.net.Uri; import android.os.Process; +import android.provider.Settings; import android.support.annotation.NonNull; import android.support.customtabs.CustomTabsIntent; import android.view.Gravity; @@ -28,6 +30,7 @@ import android.widget.RelativeLayout; import android.widget.ScrollView; import android.widget.Switch; +import android.widget.TextView; import android.widget.Toast; import android.app.AndroidAppHelper; @@ -71,11 +74,12 @@ public void handleLoadPackage(@NonNull XC_LoadPackage.LoadPackageParam lparam) t if (!lparam.packageName.equals(PACKAGE)) return; final XSharedPreferences xModulePrefs = new XSharedPreferences(MODULE, "options"); + final XSharedPreferences xPackagePrefs = new XSharedPreferences(PACKAGE, MODULE + "-options"); XSharedPreferences xPrefs; if (xModulePrefs.getBoolean("unembed_options", false)) { xPrefs = xModulePrefs; } else { - xPrefs = new XSharedPreferences(PACKAGE, MODULE + "-options"); + xPrefs = xPackagePrefs; } for (LimeOptions.Option option : limeOptions.options) { option.checked = xPrefs.getBoolean(option.name, option.checked); @@ -83,6 +87,79 @@ public void handleLoadPackage(@NonNull XC_LoadPackage.LoadPackageParam lparam) t Class hookTarget; + if (xPackagePrefs.getBoolean("spoof_android_id", false)) { + XposedHelpers.findAndHookMethod(Settings.Secure.class, "getString", ContentResolver.class, String.class, new XC_MethodHook() { + @Override + protected void beforeHookedMethod(MethodHookParam param) throws Throwable { + if (param.args[1].toString().equals(Settings.Secure.ANDROID_ID)) { + param.setResult("0000000000000000"); + } + } + }); + } + + hookTarget = lparam.classLoader.loadClass("com.linecorp.registration.ui.RegistrationActivity"); + XposedBridge.hookAllMethods(hookTarget, "onCreate", new XC_MethodHook() { + @Override + protected void afterHookedMethod(MethodHookParam param) throws Throwable { + Activity activity = (Activity) param.thisObject; + + + ViewGroup viewGroup = (ViewGroup) ((ViewGroup) activity.findViewById(2131427495)).getChildAt(1); + + Method mAddAddAssertPath = AssetManager.class.getDeclaredMethod("addAssetPath", String.class); + mAddAddAssertPath.setAccessible(true); + mAddAddAssertPath.invoke(activity.getResources().getAssets(), MODULE_PATH); + + SharedPreferences prefs = activity.getSharedPreferences(MODULE + "-options", Context.MODE_PRIVATE); + + FrameLayout frameLayout = new FrameLayout(activity); + frameLayout.setLayoutParams(new ViewGroup.LayoutParams( + ViewGroup.LayoutParams.MATCH_PARENT, + ViewGroup.LayoutParams.MATCH_PARENT)); + + Switch switchView = new Switch(activity); + switchView.setText(activity.getString(R.string.switch_spoof_android_id)); + FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams( + FrameLayout.LayoutParams.WRAP_CONTENT, + FrameLayout.LayoutParams.WRAP_CONTENT); + layoutParams.gravity = Gravity.CENTER; + switchView.setLayoutParams(layoutParams); + + AlertDialog.Builder builder = new AlertDialog.Builder(activity) + .setTitle(activity.getString(R.string.options_title)) + .setCancelable(false); + + TextView textView = new TextView(activity); + textView.setText(R.string.spoof_android_id_risk); + textView.setPadding(Utils.dpToPx(20, activity), Utils.dpToPx(20, activity), Utils.dpToPx(20, activity), Utils.dpToPx(20, activity)); + builder.setView(textView); + + builder.setPositiveButton(activity.getString(R.string.positive), new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int which) { + Toast.makeText(activity.getApplicationContext(), activity.getString(R.string.restarting), Toast.LENGTH_SHORT).show(); + activity.finish(); + } + }); + + AlertDialog dialog = builder.create(); + + switchView.setChecked(prefs.getBoolean("spoof_android_id", false)); + switchView.setOnCheckedChangeListener((buttonView, isChecked) -> { + prefs.edit().putBoolean("spoof_android_id", isChecked).apply(); + if (isChecked) dialog.show(); + else { + Toast.makeText(activity.getApplicationContext(), activity.getString(R.string.restarting), Toast.LENGTH_SHORT).show(); + activity.finish(); + } + }); + + frameLayout.addView(switchView); + viewGroup.addView(frameLayout); + } + }); + if (!xModulePrefs.getBoolean("unembed_options", false)) { hookTarget = lparam.classLoader.loadClass("com.linecorp.line.settings.main.LineUserMainSettingsFragment"); XposedBridge.hookAllMethods(hookTarget, "onViewCreated", new XC_MethodHook() { diff --git a/app/src/main/res/values-ja/strings.xml b/app/src/main/res/values-ja/strings.xml index 47a2d1ef..6725192c 100644 --- a/app/src/main/res/values-ja/strings.xml +++ b/app/src/main/res/values-ja/strings.xml @@ -11,6 +11,8 @@ モジュールが有効化されていません! 設定 アプリを再起動しています... + 複数デバイスログイン (Android ID を偽装) + Android ID の偽装は自己責任です 設定を LINE に埋め込まない (設定は同期されません) VOOM アイコンを削除 ウォレットアイコンを削除 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index fca72e7a..79cf995e 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -11,6 +11,8 @@ Module not enabled! Options Restarting now... + Multiple device login (spoof Android ID) + Spoofing Android ID is at your own risk Do not embed options in LINE (options will not be synchronized) Delete the VOOM icon Delete the wallet icon