Skip to content

Commit

Permalink
app: ui: InfoActivity: show Secure Folder warning dialog on One UI 3.x
Browse files Browse the repository at this point in the history
Three to-be-translated strings have been added:
sep_12_crypto_warning_dialog_title
sep_12_crypto_warning_dialog_message
sep_12_crypto_warning_dialog_btn

Signed-off-by: BlackMesa123 <[email protected]>
  • Loading branch information
salvogiangri committed Mar 9, 2023
1 parent 6c24a12 commit 23e6151
Show file tree
Hide file tree
Showing 8 changed files with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
import android.net.Uri;
import android.os.Build;
import android.os.Bundle;
import android.os.SemSystemProperties;
import android.os.SystemClock;
import android.text.SpannableStringBuilder;
import android.text.Spanned;
Expand All @@ -46,6 +47,7 @@

import androidx.annotation.NonNull;
import androidx.appcompat.app.ActionBar;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.app.AppCompatActivity;
import androidx.core.widget.SeslEdgeEffect;
import androidx.recyclerview.widget.DividerItemDecoration;
Expand Down Expand Up @@ -77,6 +79,8 @@ protected void onCreate(Bundle savedInstanceState) {
setContentSideMargin(getResources().getConfiguration(),
mBinding.mainContent);
initListView();

showCryptoWarningDialog();
}

private void initToolbar() {
Expand Down Expand Up @@ -186,6 +190,22 @@ protected EdgeEffect createEdgeEffect(@NonNull RecyclerView view, int direction)
listView.seslSetLastRoundedCorner(true);
}

private void showCryptoWarningDialog() {
if (Build.VERSION.SDK_INT == 30) {
String cryptoState = SemSystemProperties.get("ro.crypto.state", "");
String cryptoType = SemSystemProperties.get("ro.crypto.type", "");

if (!cryptoState.equals("unencrypted") && !cryptoType.isEmpty()) {
AlertDialog dialog = new AlertDialog.Builder(this)
.setTitle(R.string.sep_12_crypto_warning_dialog_title)
.setMessage(R.string.sep_12_crypto_warning_dialog_message)
.setPositiveButton(R.string.sep_12_crypto_warning_dialog_btn, null)
.create();
dialog.show();
}
}
}

@SuppressWarnings("deprecation")
private void applyLandscapeFullScreen() {
Configuration config = getResources().getConfiguration();
Expand Down
4 changes: 4 additions & 0 deletions app/src/main/res/values-en-rCA/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<string name="build_number_title">Build number</string>
<string name="knox_version_title">Knox version</string>
<string name="knox_features_title">Knox features</string>

<string name="sep_12_crypto_warning_dialog_title">Your data partition is encrypted</string>
<string name="sep_12_crypto_warning_dialog_message">This app has detected that your device data partition is encrypted, this means Secure Folder might not work properly.</string>
<string name="sep_12_crypto_warning_dialog_btn">I understand</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values-en-rPH/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<string name="build_number_title">Build number</string>
<string name="knox_version_title">Knox version</string>
<string name="knox_features_title">Knox features</string>

<string name="sep_12_crypto_warning_dialog_title">Your data partition is encrypted</string>
<string name="sep_12_crypto_warning_dialog_message">This app has detected that your device data partition is encrypted, this means Secure Folder might not work properly.</string>
<string name="sep_12_crypto_warning_dialog_btn">I understand</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values-en-rUS/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<string name="build_number_title">Build number</string>
<string name="knox_version_title">Knox version</string>
<string name="knox_features_title">Knox features</string>

<string name="sep_12_crypto_warning_dialog_title">Your data partition is encrypted</string>
<string name="sep_12_crypto_warning_dialog_message">This app has detected that your device data partition is encrypted, this means Secure Folder might not work properly.</string>
<string name="sep_12_crypto_warning_dialog_btn">I understand</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values-en-rZG/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<string name="build_number_title">Build number</string>
<string name="knox_version_title">Knox version</string>
<string name="knox_features_title">Knox features</string>

<string name="sep_12_crypto_warning_dialog_title">Your data partition is encrypted</string>
<string name="sep_12_crypto_warning_dialog_message">This app has detected that your device data partition is encrypted, this means Secure Folder might not work properly.</string>
<string name="sep_12_crypto_warning_dialog_btn">I understand</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values-en/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<string name="build_number_title">Build number</string>
<string name="knox_version_title">Knox version</string>
<string name="knox_features_title">Knox features</string>

<string name="sep_12_crypto_warning_dialog_title">Your data partition is encrypted</string>
<string name="sep_12_crypto_warning_dialog_message">This app has detected that your device data partition is encrypted, this means Secure Folder might not work properly.</string>
<string name="sep_12_crypto_warning_dialog_btn">I understand</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values-it/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,8 @@
<string name="build_number_title">Versione build</string>
<string name="knox_version_title">Versione Knox</string>
<string name="knox_features_title">Funzionalità Knox</string>

<string name="sep_12_crypto_warning_dialog_title">Partizione dati criptata</string>
<string name="sep_12_crypto_warning_dialog_message">L\'app ha rilevato che la partizione dati del tuo dispositivo è criptata, l\'app Area Personale potrebbe non funzionare correttamente.</string>
<string name="sep_12_crypto_warning_dialog_btn">Ho capito</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,8 @@
<string name="knox_version_knox_dualdar" translatable="false">DualDAR</string>
<string name="knox_version_knox_hdm" translatable="false">HDM</string>
<string name="knox_features_title">Knox features</string>

<string name="sep_12_crypto_warning_dialog_title">Your data partition is encrypted</string>
<string name="sep_12_crypto_warning_dialog_message">This app has detected that your device data partition is encrypted, this means Secure Folder might not work properly.</string>
<string name="sep_12_crypto_warning_dialog_btn">I understand</string>
</resources>

0 comments on commit 23e6151

Please sign in to comment.