proper const naming

This commit is contained in:
Dominik Schürmann 2015-09-28 10:15:38 +02:00
parent 3c9df2fc74
commit 6de7d9f3f0
4 changed files with 21 additions and 21 deletions

View File

@ -110,7 +110,7 @@ abstract public class Installer {
boolean isSystemInstallerEnabled = Preferences.get().isPrivilegedInstallerEnabled(); boolean isSystemInstallerEnabled = Preferences.get().isPrivilegedInstallerEnabled();
if (isSystemInstallerEnabled) { if (isSystemInstallerEnabled) {
if (PrivilegedInstaller.isExtensionInstalledCorrectly(activity) if (PrivilegedInstaller.isExtensionInstalledCorrectly(activity)
== PrivilegedInstaller.EXTENSION_INSTALLED_YES) { == PrivilegedInstaller.IS_EXTENSION_INSTALLED_YES) {
Utils.debugLog(TAG, "system permissions -> SystemInstaller"); Utils.debugLog(TAG, "system permissions -> SystemInstaller");
try { try {

View File

@ -81,10 +81,10 @@ public class PrivilegedInstaller extends Installer {
public static final int REQUEST_CONFIRM_PERMS = 0; public static final int REQUEST_CONFIRM_PERMS = 0;
public static final int EXTENSION_INSTALLED_NO = 0; public static final int IS_EXTENSION_INSTALLED_NO = 0;
public static final int EXTENSION_INSTALLED_YES = 1; public static final int IS_EXTENSION_INSTALLED_YES = 1;
public static final int EXTENSION_INSTALLED_SIGNATURE_PROBLEM = 2; public static final int IS_EXTENSION_INSTALLED_SIGNATURE_PROBLEM = 2;
public static final int EXTENSION_INSTALLED_PERMISSIONS_PROBLEM = 3; public static final int IS_EXTENSION_INSTALLED_PERMISSIONS_PROBLEM = 3;
public PrivilegedInstaller(Activity activity, PackageManager pm, public PrivilegedInstaller(Activity activity, PackageManager pm,
InstallerCallback callback) throws AndroidNotCompatibleException { InstallerCallback callback) throws AndroidNotCompatibleException {
@ -106,7 +106,7 @@ public class PrivilegedInstaller extends Installer {
// check if installed // check if installed
if (!isExtensionInstalled(context)) { if (!isExtensionInstalled(context)) {
return EXTENSION_INSTALLED_NO; return IS_EXTENSION_INSTALLED_NO;
} }
// check if it has the privileged permissions granted // check if it has the privileged permissions granted
@ -138,7 +138,7 @@ public class PrivilegedInstaller extends Installer {
context.getApplicationContext().bindService(serviceIntent, mServiceConnection, context.getApplicationContext().bindService(serviceIntent, mServiceConnection,
Context.BIND_AUTO_CREATE); Context.BIND_AUTO_CREATE);
} catch (SecurityException e) { } catch (SecurityException e) {
return EXTENSION_INSTALLED_SIGNATURE_PROBLEM; return IS_EXTENSION_INSTALLED_SIGNATURE_PROBLEM;
} }
synchronized (mutex) { synchronized (mutex) {
@ -151,9 +151,9 @@ public class PrivilegedInstaller extends Installer {
boolean hasPermissions = returnBundle.getBoolean("has_permissions", false); boolean hasPermissions = returnBundle.getBoolean("has_permissions", false);
if (hasPermissions) { if (hasPermissions) {
return EXTENSION_INSTALLED_YES; return IS_EXTENSION_INSTALLED_YES;
} else { } else {
return EXTENSION_INSTALLED_PERMISSIONS_PROBLEM; return IS_EXTENSION_INSTALLED_PERMISSIONS_PROBLEM;
} }
} }

View File

@ -97,16 +97,16 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
int isInstalledCorrectly = PrivilegedInstaller.isExtensionInstalledCorrectly(context); int isInstalledCorrectly = PrivilegedInstaller.isExtensionInstalledCorrectly(context);
switch (isInstalledCorrectly) { switch (isInstalledCorrectly) {
case PrivilegedInstaller.EXTENSION_INSTALLED_YES: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_YES:
Preferences.get().setPrivilegedInstallerEnabled(true); Preferences.get().setPrivilegedInstallerEnabled(true);
break; break;
case PrivilegedInstaller.EXTENSION_INSTALLED_NO: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_NO:
runFirstTime(context); runFirstTime(context);
break; break;
case PrivilegedInstaller.EXTENSION_INSTALLED_PERMISSIONS_PROBLEM: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_PERMISSIONS_PROBLEM:
case PrivilegedInstaller.EXTENSION_INSTALLED_SIGNATURE_PROBLEM: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_SIGNATURE_PROBLEM:
default: default:
// do nothing // do nothing
} }
@ -338,7 +338,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
String message; String message;
final int result; final int result;
switch (isInstalledCorrectly) { switch (isInstalledCorrectly) {
case PrivilegedInstaller.EXTENSION_INSTALLED_YES: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_YES:
title = getString(R.string.system_install_post_success); title = getString(R.string.system_install_post_success);
message = getString(R.string.system_install_post_success_message); message = getString(R.string.system_install_post_success_message);
result = Activity.RESULT_OK; result = Activity.RESULT_OK;
@ -346,18 +346,18 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
// enable system installer on installation success // enable system installer on installation success
Preferences.get().setPrivilegedInstallerEnabled(true); Preferences.get().setPrivilegedInstallerEnabled(true);
break; break;
case PrivilegedInstaller.EXTENSION_INSTALLED_NO: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_NO:
title = getString(R.string.system_install_post_fail); title = getString(R.string.system_install_post_fail);
message = getString(R.string.system_install_post_fail_message); message = getString(R.string.system_install_post_fail_message);
result = Activity.RESULT_CANCELED; result = Activity.RESULT_CANCELED;
break; break;
case PrivilegedInstaller.EXTENSION_INSTALLED_SIGNATURE_PROBLEM: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_SIGNATURE_PROBLEM:
title = getString(R.string.system_install_post_fail); title = getString(R.string.system_install_post_fail);
message = getString(R.string.system_install_post_fail_message) + message = getString(R.string.system_install_post_fail_message) +
"\n\n" + getString(R.string.system_install_denied_signature); "\n\n" + getString(R.string.system_install_denied_signature);
result = Activity.RESULT_CANCELED; result = Activity.RESULT_CANCELED;
break; break;
case PrivilegedInstaller.EXTENSION_INSTALLED_PERMISSIONS_PROBLEM: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_PERMISSIONS_PROBLEM:
title = getString(R.string.system_install_post_fail); title = getString(R.string.system_install_post_fail);
message = getString(R.string.system_install_post_fail_message) + message = getString(R.string.system_install_post_fail_message) +
"\n\n" + getString(R.string.system_install_denied_permissions); "\n\n" + getString(R.string.system_install_denied_permissions);

View File

@ -196,7 +196,7 @@ public class PreferencesFragment extends PreferenceFragment
if (pref.isChecked()) { if (pref.isChecked()) {
int isInstalledCorrectly = int isInstalledCorrectly =
PrivilegedInstaller.isExtensionInstalledCorrectly(getActivity()); PrivilegedInstaller.isExtensionInstalledCorrectly(getActivity());
if (isInstalledCorrectly == PrivilegedInstaller.EXTENSION_INSTALLED_YES) { if (isInstalledCorrectly == PrivilegedInstaller.IS_EXTENSION_INSTALLED_YES) {
// privileged permission are granted, i.e. the extension is installed correctly // privileged permission are granted, i.e. the extension is installed correctly
SharedPreferences.Editor editor = pref.getSharedPreferences().edit(); SharedPreferences.Editor editor = pref.getSharedPreferences().edit();
editor.putBoolean(Preferences.PREF_PRIVILEGED_INSTALLER, true); editor.putBoolean(Preferences.PREF_PRIVILEGED_INSTALLER, true);
@ -214,14 +214,14 @@ public class PreferencesFragment extends PreferenceFragment
String message = null; String message = null;
switch (isInstalledCorrectly) { switch (isInstalledCorrectly) {
case PrivilegedInstaller.EXTENSION_INSTALLED_NO: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_NO:
message = getActivity().getString(R.string.system_install_denied_body) + message = getActivity().getString(R.string.system_install_denied_body) +
"<br/><br/>" + getActivity().getString(R.string.system_install_question); "<br/><br/>" + getActivity().getString(R.string.system_install_question);
break; break;
case PrivilegedInstaller.EXTENSION_INSTALLED_SIGNATURE_PROBLEM: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_SIGNATURE_PROBLEM:
message = getActivity().getString(R.string.system_install_denied_signature); message = getActivity().getString(R.string.system_install_denied_signature);
break; break;
case PrivilegedInstaller.EXTENSION_INSTALLED_PERMISSIONS_PROBLEM: case PrivilegedInstaller.IS_EXTENSION_INSTALLED_PERMISSIONS_PROBLEM:
message = getActivity().getString(R.string.system_install_denied_permissions); message = getActivity().getString(R.string.system_install_denied_permissions);
break; break;
default: default: