Notify su db corruption

This commit is contained in:
topjohnwu 2017-11-21 02:21:37 +08:00
parent bd37d90228
commit 708d8f75c0
3 changed files with 5 additions and 1 deletions

View File

@ -9,8 +9,10 @@ import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper; import android.database.sqlite.SQLiteOpenHelper;
import android.os.Build; import android.os.Build;
import android.text.TextUtils; import android.text.TextUtils;
import android.widget.Toast;
import com.topjohnwu.magisk.MagiskManager; import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.container.Policy; import com.topjohnwu.magisk.container.Policy;
import com.topjohnwu.magisk.container.SuLogEntry; import com.topjohnwu.magisk.container.SuLogEntry;
import com.topjohnwu.magisk.utils.Shell; import com.topjohnwu.magisk.utils.Shell;
@ -171,6 +173,7 @@ public class SuDatabaseHelper extends SQLiteOpenHelper {
@Override @Override
public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) { public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
MagiskManager.toast(R.string.su_db_corrupt, Toast.LENGTH_LONG);
// Remove everything, we do not support downgrade // Remove everything, we do not support downgrade
db.execSQL("DROP TABLE IF EXISTS " + POLICY_TABLE); db.execSQL("DROP TABLE IF EXISTS " + POLICY_TABLE);
db.execSQL("DROP TABLE IF EXISTS " + LOG_TABLE); db.execSQL("DROP TABLE IF EXISTS " + LOG_TABLE);

View File

@ -206,5 +206,6 @@
<string name="invalid_update_channel">不合法的更新頻道</string> <string name="invalid_update_channel">不合法的更新頻道</string>
<string name="settings_update_custom">自訂</string> <string name="settings_update_custom">自訂</string>
<string name="settings_update_custom_msg">請輸入自訂網址</string> <string name="settings_update_custom_msg">請輸入自訂網址</string>
<string name="su_db_corrupt">SU 資料庫已毀損,將會重新建置</string>
</resources> </resources>

View File

@ -14,7 +14,6 @@
<!--Status Fragment--> <!--Status Fragment-->
<string name="magisk_version_error">Magisk is not installed</string> <string name="magisk_version_error">Magisk is not installed</string>
<string name="checking_for_updates">Checking for updates…</string> <string name="checking_for_updates">Checking for updates…</string>
<string name="magisk_update_available">Magisk v%1$s is available!</string> <string name="magisk_update_available">Magisk v%1$s is available!</string>
<string name="invalid_update_channel">Invalid Update Channel</string> <string name="invalid_update_channel">Invalid Update Channel</string>
@ -118,6 +117,7 @@
<string name="uninstall_toast">Uninstalling Magisk Manager in 5 seconds, please manually reboot afterwards</string> <string name="uninstall_toast">Uninstalling Magisk Manager in 5 seconds, please manually reboot afterwards</string>
<string name="proprietary_title">Download Proprietary Code</string> <string name="proprietary_title">Download Proprietary Code</string>
<string name="proprietary_notice">Magisk Manager is FOSS so doesn\'t contain Google\'s proprietary SafetyNet API code.\n\nDo you allow Magisk Manager to download an extension (contains GoogleApiClient) for SafetyNet checks?</string> <string name="proprietary_notice">Magisk Manager is FOSS so doesn\'t contain Google\'s proprietary SafetyNet API code.\n\nDo you allow Magisk Manager to download an extension (contains GoogleApiClient) for SafetyNet checks?</string>
<string name="su_db_corrupt">SU database is corrupted, will recreate new db</string>
<!--Settings Activity --> <!--Settings Activity -->
<string name="settings_general_category">General</string> <string name="settings_general_category">General</string>