Loading java/src/com/android/inputmethod/latin/LatinIME.java +17 −6 Original line number Diff line number Diff line Loading @@ -877,14 +877,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mSuggestionStripView.setListener(this, view); } Context secureContext = createPackageContext( "com.android.inputmethod.latin", Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY ); ImageButton floatingButton = view.findViewById(R.id.floating_button); if (floatingButton != null) { if (isSetupWizardFinished() && (accountIsPremium(getApplicationContext()) || accountIsPremium(secureContext))) { if (isSetupWizardFinished() && (accountIsPremium(getApplicationContext()) || accountIsPremiumFromIME())) { floatingButton.setVisibility(View.VISIBLE); floatingButton.setOnClickListener(new View.OnClickListener() { @Override Loading Loading @@ -914,6 +909,22 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen return isDeviceProvisioned; } private boolean accountIsPremiumFromIME() { try { final Context secureContext = createPackageContext( "com.android.inputmethod.latin", Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY ); Log.d(TAG, "Contexte sécurisé créé avec succès: " + secureContext); return accountIsPremium(secureContext); } catch (PackageManager.NameNotFoundException e) { // Cas gravissime, impossible réellement en théorie dans ton cas précis Log.wtf(TAG, "Erreur CRITIQUE: Le package LatinIME n'est pas trouvé par createPackageContext()", e); // Logique de secours absolue: repli sur contexte initial même si restreint, mieux que rien return accountIsPremium(this); } } private boolean accountIsPremium(Context context) { if(ContextCompat.checkSelfPermission(context, android.Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) { Log.e(TAG, "Missing permission"); Loading Loading
java/src/com/android/inputmethod/latin/LatinIME.java +17 −6 Original line number Diff line number Diff line Loading @@ -877,14 +877,9 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen mSuggestionStripView.setListener(this, view); } Context secureContext = createPackageContext( "com.android.inputmethod.latin", Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY ); ImageButton floatingButton = view.findViewById(R.id.floating_button); if (floatingButton != null) { if (isSetupWizardFinished() && (accountIsPremium(getApplicationContext()) || accountIsPremium(secureContext))) { if (isSetupWizardFinished() && (accountIsPremium(getApplicationContext()) || accountIsPremiumFromIME())) { floatingButton.setVisibility(View.VISIBLE); floatingButton.setOnClickListener(new View.OnClickListener() { @Override Loading Loading @@ -914,6 +909,22 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen return isDeviceProvisioned; } private boolean accountIsPremiumFromIME() { try { final Context secureContext = createPackageContext( "com.android.inputmethod.latin", Context.CONTEXT_INCLUDE_CODE | Context.CONTEXT_IGNORE_SECURITY ); Log.d(TAG, "Contexte sécurisé créé avec succès: " + secureContext); return accountIsPremium(secureContext); } catch (PackageManager.NameNotFoundException e) { // Cas gravissime, impossible réellement en théorie dans ton cas précis Log.wtf(TAG, "Erreur CRITIQUE: Le package LatinIME n'est pas trouvé par createPackageContext()", e); // Logique de secours absolue: repli sur contexte initial même si restreint, mieux que rien return accountIsPremium(this); } } private boolean accountIsPremium(Context context) { if(ContextCompat.checkSelfPermission(context, android.Manifest.permission.GET_ACCOUNTS) != PackageManager.PERMISSION_GRANTED) { Log.e(TAG, "Missing permission"); Loading