checkstyle: Add UnnecessaryParentheses
This commit is contained in:
parent
561d7833d1
commit
0a13cf5c63
@ -373,7 +373,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
fdroidApp = ((FDroidApp) getApplication());
|
fdroidApp = (FDroidApp) getApplication();
|
||||||
fdroidApp.applyTheme(this);
|
fdroidApp.applyTheme(this);
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
@ -1523,7 +1523,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
* Shows or hides progress bar and related views.
|
* Shows or hides progress bar and related views.
|
||||||
*/
|
*/
|
||||||
private void setProgressVisible(boolean visible) {
|
private void setProgressVisible(boolean visible) {
|
||||||
int state = (visible) ? View.VISIBLE : View.GONE;
|
int state = visible ? View.VISIBLE : View.GONE;
|
||||||
progressBar.setVisibility(state);
|
progressBar.setVisibility(state);
|
||||||
progressSize.setVisibility(state);
|
progressSize.setVisibility(state);
|
||||||
progressPercent.setVisibility(state);
|
progressPercent.setVisibility(state);
|
||||||
@ -1614,7 +1614,7 @@ public class AppDetails extends AppCompatActivity implements ProgressListener, A
|
|||||||
if (updateWanted) {
|
if (updateWanted) {
|
||||||
if (getApp().suggestedVercode > 0) {
|
if (getApp().suggestedVercode > 0) {
|
||||||
final Apk apkToInstall = ApkProvider.Helper.find(activity, getApp().id, getApp().suggestedVercode);
|
final Apk apkToInstall = ApkProvider.Helper.find(activity, getApp().id, getApp().suggestedVercode);
|
||||||
(activity).install(apkToInstall);
|
activity.install(apkToInstall);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -69,7 +69,7 @@ public class FDroid extends ActionBarActivity {
|
|||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
|
|
||||||
fdroidApp = ((FDroidApp) getApplication());
|
fdroidApp = (FDroidApp) getApplication();
|
||||||
fdroidApp.applyTheme(this);
|
fdroidApp.applyTheme(this);
|
||||||
|
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
@ -140,7 +140,7 @@ public class FDroidApp extends Application {
|
|||||||
public static void initWifiSettings() {
|
public static void initWifiSettings() {
|
||||||
port = 8888;
|
port = 8888;
|
||||||
ipAddressString = null;
|
ipAddressString = null;
|
||||||
subnetInfo = (new SubnetUtils("0.0.0.0/32").getInfo());
|
subnetInfo = new SubnetUtils("0.0.0.0/32").getInfo();
|
||||||
ssid = "";
|
ssid = "";
|
||||||
bssid = "";
|
bssid = "";
|
||||||
}
|
}
|
||||||
|
@ -462,7 +462,7 @@ public final class Utils {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static String str(CommaSeparatedList instance) {
|
public static String str(CommaSeparatedList instance) {
|
||||||
return (instance == null ? null : instance.toString());
|
return instance == null ? null : instance.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -11,7 +11,7 @@ public abstract class Compatibility {
|
|||||||
|
|
||||||
// like maxSdkVersion
|
// like maxSdkVersion
|
||||||
protected static boolean upToApi(int apiLevel) {
|
protected static boolean upToApi(int apiLevel) {
|
||||||
return (apiLevel < 1 || getApi() <= apiLevel);
|
return apiLevel < 1 || getApi() <= apiLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static int getApi() {
|
protected static int getApi() {
|
||||||
|
@ -340,8 +340,8 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
apk.sig = Utils.hashBytes(fdroidSig, "md5");
|
apk.sig = Utils.hashBytes(fdroidSig, "md5");
|
||||||
|
|
||||||
this.installedApk = apk;
|
this.installedApk = apk;
|
||||||
this.system = ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
|
this.system = (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
|
||||||
this.updatedSystemApp = ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0);
|
this.updatedSystemApp = (appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
|
||||||
this.uninstallable = !this.system || this.updatedSystemApp;
|
this.uninstallable = !this.system || this.updatedSystemApp;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -405,7 +405,7 @@ public class App extends ValueObject implements Comparable<App> {
|
|||||||
public boolean hasUpdates() {
|
public boolean hasUpdates() {
|
||||||
boolean updates = false;
|
boolean updates = false;
|
||||||
if (suggestedVercode > 0) {
|
if (suggestedVercode > 0) {
|
||||||
updates = (installedVersionCode > 0 && installedVersionCode < suggestedVercode);
|
updates = installedVersionCode > 0 && installedVersionCode < suggestedVercode;
|
||||||
}
|
}
|
||||||
return updates;
|
return updates;
|
||||||
}
|
}
|
||||||
|
@ -301,7 +301,7 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
while (!cursor.isAfterLast()) {
|
while (!cursor.isAfterLast()) {
|
||||||
Repo repo = new Repo();
|
Repo repo = new Repo();
|
||||||
repo.address = cursor.getString(0);
|
repo.address = cursor.getString(0);
|
||||||
repo.inuse = (cursor.getInt(1) == 1);
|
repo.inuse = cursor.getInt(1) == 1;
|
||||||
repo.pubkey = cursor.getString(2);
|
repo.pubkey = cursor.getString(2);
|
||||||
oldrepos.add(repo);
|
oldrepos.add(repo);
|
||||||
cursor.moveToNext();
|
cursor.moveToNext();
|
||||||
@ -491,8 +491,8 @@ public class DBHelper extends SQLiteOpenHelper {
|
|||||||
|
|
||||||
private static boolean columnExists(SQLiteDatabase db,
|
private static boolean columnExists(SQLiteDatabase db,
|
||||||
String table, String column) {
|
String table, String column) {
|
||||||
return (db.rawQuery("select * from " + table + " limit 0,1", null)
|
return db.rawQuery("select * from " + table + " limit 0,1", null)
|
||||||
.getColumnIndex(column) != -1);
|
.getColumnIndex(column) != -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -255,8 +255,8 @@ public class PrivilegedInstaller extends Installer {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
final boolean isSystem = ((appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0);
|
final boolean isSystem = (appInfo.flags & ApplicationInfo.FLAG_SYSTEM) != 0;
|
||||||
final boolean isUpdate = ((appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0);
|
final boolean isUpdate = (appInfo.flags & ApplicationInfo.FLAG_UPDATED_SYSTEM_APP) != 0;
|
||||||
|
|
||||||
if (isSystem && !isUpdate) {
|
if (isSystem && !isUpdate) {
|
||||||
// Cannot remove system apps unless we're uninstalling updates
|
// Cannot remove system apps unless we're uninstalling updates
|
||||||
|
@ -88,11 +88,9 @@ public class BluetoothDownloader extends Downloader {
|
|||||||
@Override
|
@Override
|
||||||
public boolean isCached() {
|
public boolean isCached() {
|
||||||
FileDetails details = getFileDetails();
|
FileDetails details = getFileDetails();
|
||||||
return (
|
return details != null &&
|
||||||
details != null &&
|
|
||||||
details.getCacheTag() != null &&
|
details.getCacheTag() != null &&
|
||||||
details.getCacheTag().equals(getCacheTag())
|
details.getCacheTag().equals(getCacheTag());
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -223,10 +223,10 @@ public class WifiStateChangeService extends Service {
|
|||||||
return null;
|
return null;
|
||||||
} else {
|
} else {
|
||||||
return String.format(Locale.ENGLISH, "%d.%d.%d.%d",
|
return String.format(Locale.ENGLISH, "%d.%d.%d.%d",
|
||||||
(ipAddress & 0xff),
|
ipAddress & 0xff,
|
||||||
(ipAddress >> 8 & 0xff),
|
ipAddress >> 8 & 0xff,
|
||||||
(ipAddress >> 16 & 0xff),
|
ipAddress >> 16 & 0xff,
|
||||||
(ipAddress >> 24 & 0xff));
|
ipAddress >> 24 & 0xff);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -120,7 +120,7 @@ public class InstallExtensionDialogActivity extends FragmentActivity {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected Boolean doInBackground(Void... params) {
|
protected Boolean doInBackground(Void... params) {
|
||||||
return (Shell.SU.version(true) != null);
|
return Shell.SU.version(true) != null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -433,14 +433,14 @@ public class AppSecurityPermissions {
|
|||||||
private boolean isDisplayablePermission(PermissionInfo pInfo, int newReqFlags,
|
private boolean isDisplayablePermission(PermissionInfo pInfo, int newReqFlags,
|
||||||
int existingReqFlags) {
|
int existingReqFlags) {
|
||||||
final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
|
final int base = pInfo.protectionLevel & PermissionInfo.PROTECTION_MASK_BASE;
|
||||||
final boolean isNormal = (base == PermissionInfo.PROTECTION_NORMAL);
|
final boolean isNormal = base == PermissionInfo.PROTECTION_NORMAL;
|
||||||
final boolean isDangerous = (base == PermissionInfo.PROTECTION_DANGEROUS);
|
final boolean isDangerous = base == PermissionInfo.PROTECTION_DANGEROUS;
|
||||||
final boolean isRequired =
|
final boolean isRequired =
|
||||||
((newReqFlags & PackageInfo.REQUESTED_PERMISSION_REQUIRED) != 0);
|
(newReqFlags & PackageInfo.REQUESTED_PERMISSION_REQUIRED) != 0;
|
||||||
final boolean wasGranted =
|
final boolean wasGranted =
|
||||||
((existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0);
|
(existingReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0;
|
||||||
final boolean isGranted =
|
final boolean isGranted =
|
||||||
((newReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0);
|
(newReqFlags & PackageInfo.REQUESTED_PERMISSION_GRANTED) != 0;
|
||||||
|
|
||||||
// Dangerous and normal permissions are always shown to the user if the permission
|
// Dangerous and normal permissions are always shown to the user if the permission
|
||||||
// is required, or it was previously granted
|
// is required, or it was previously granted
|
||||||
@ -450,7 +450,7 @@ public class AppSecurityPermissions {
|
|||||||
}
|
}
|
||||||
|
|
||||||
final boolean isDevelopment =
|
final boolean isDevelopment =
|
||||||
((pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0);
|
(pInfo.protectionLevel & PermissionInfo.PROTECTION_FLAG_DEVELOPMENT) != 0;
|
||||||
|
|
||||||
// Development permissions are only shown to the user if they are already
|
// Development permissions are only shown to the user if they are already
|
||||||
// granted to the app -- if we are installing an app and they are not
|
// granted to the app -- if we are installing an app and they are not
|
||||||
|
@ -93,7 +93,7 @@ public class InstallConfirmActivity extends Activity implements OnCancelListener
|
|||||||
mScrollView = new CaffeinatedScrollView(this);
|
mScrollView = new CaffeinatedScrollView(this);
|
||||||
mScrollView.setFillViewport(true);
|
mScrollView.setFillViewport(true);
|
||||||
final boolean newPermissionsFound =
|
final boolean newPermissionsFound =
|
||||||
(perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0);
|
perms.getPermissionCount(AppSecurityPermissions.WHICH_NEW) > 0;
|
||||||
if (newPermissionsFound) {
|
if (newPermissionsFound) {
|
||||||
permVisible = true;
|
permVisible = true;
|
||||||
mScrollView.addView(perms.getPermissionsView(
|
mScrollView.addView(perms.getPermissionsView(
|
||||||
|
@ -140,9 +140,9 @@ public abstract class AppListAdapter extends CursorAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void layoutIcon(ImageView icon, boolean compact) {
|
private void layoutIcon(ImageView icon, boolean compact) {
|
||||||
int size = (int) mContext.getResources().getDimension((compact
|
int size = (int) mContext.getResources().getDimension(compact
|
||||||
? R.dimen.applist_icon_compact_size
|
? R.dimen.applist_icon_compact_size
|
||||||
: R.dimen.applist_icon_normal_size));
|
: R.dimen.applist_icon_normal_size);
|
||||||
|
|
||||||
LinearLayout.LayoutParams params =
|
LinearLayout.LayoutParams params =
|
||||||
(LinearLayout.LayoutParams) icon.getLayoutParams();
|
(LinearLayout.LayoutParams) icon.getLayoutParams();
|
||||||
|
@ -173,7 +173,7 @@ public class SelectAppsView extends ListView implements
|
|||||||
adapter.swapCursor(cursor);
|
adapter.swapCursor(cursor);
|
||||||
|
|
||||||
for (int i = 0; i < getCount(); i++) {
|
for (int i = 0; i < getCount(); i++) {
|
||||||
Cursor c = ((Cursor) getItemAtPosition(i));
|
Cursor c = (Cursor) getItemAtPosition(i);
|
||||||
String packageName = c.getString(c.getColumnIndex(InstalledAppProvider.DataColumns.APP_ID));
|
String packageName = c.getString(c.getColumnIndex(InstalledAppProvider.DataColumns.APP_ID));
|
||||||
getState().ensureFDroidSelected();
|
getState().ensureFDroidSelected();
|
||||||
for (String selected : getState().getAppsToSwap()) {
|
for (String selected : getState().getAppsToSwap()) {
|
||||||
|
@ -213,7 +213,7 @@ public class StartSwapView extends ScrollView implements SwapWorkflowActivity.In
|
|||||||
int textResource = getManager().isBluetoothDiscoverable() ? R.string.swap_visible_bluetooth : R.string.swap_not_visible_bluetooth;
|
int textResource = getManager().isBluetoothDiscoverable() ? R.string.swap_visible_bluetooth : R.string.swap_not_visible_bluetooth;
|
||||||
textBluetoothVisible.setText(textResource);
|
textBluetoothVisible.setText(textResource);
|
||||||
|
|
||||||
final SwitchCompat bluetoothSwitch = ((SwitchCompat) findViewById(R.id.switch_bluetooth));
|
final SwitchCompat bluetoothSwitch = (SwitchCompat) findViewById(R.id.switch_bluetooth);
|
||||||
Utils.debugLog(TAG, getManager().isBluetoothDiscoverable() ? "Initially marking switch as checked, because Bluetooth is discoverable." : "Initially marking switch as not-checked, because Bluetooth is not discoverable.");
|
Utils.debugLog(TAG, getManager().isBluetoothDiscoverable() ? "Initially marking switch as checked, because Bluetooth is discoverable." : "Initially marking switch as not-checked, because Bluetooth is not discoverable.");
|
||||||
bluetoothSwitch.setChecked(getManager().isBluetoothDiscoverable());
|
bluetoothSwitch.setChecked(getManager().isBluetoothDiscoverable());
|
||||||
bluetoothSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
bluetoothSwitch.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@ -150,9 +150,9 @@ public class SwapConnecting extends LinearLayout implements SwapWorkflowActivity
|
|||||||
@Override
|
@Override
|
||||||
public void onReceive(Context context, Intent intent) {
|
public void onReceive(Context context, Intent intent) {
|
||||||
|
|
||||||
TextView progressText = ((TextView) findViewById(R.id.heading));
|
TextView progressText = (TextView) findViewById(R.id.heading);
|
||||||
TextView errorText = ((TextView) findViewById(R.id.error));
|
TextView errorText = (TextView) findViewById(R.id.error);
|
||||||
Button backButton = ((Button) findViewById(R.id.back));
|
Button backButton = (Button) findViewById(R.id.back);
|
||||||
|
|
||||||
String message;
|
String message;
|
||||||
if (intent.hasExtra(getMessageExtra())) {
|
if (intent.hasExtra(getMessageExtra())) {
|
||||||
|
@ -44,13 +44,13 @@ public class PrivilegedService extends Service {
|
|||||||
|
|
||||||
private boolean hasPrivilegedPermissionsImpl() {
|
private boolean hasPrivilegedPermissionsImpl() {
|
||||||
boolean hasInstallPermission =
|
boolean hasInstallPermission =
|
||||||
(getPackageManager().checkPermission(Manifest.permission.INSTALL_PACKAGES, getPackageName())
|
getPackageManager().checkPermission(Manifest.permission.INSTALL_PACKAGES, getPackageName())
|
||||||
== PackageManager.PERMISSION_GRANTED);
|
== PackageManager.PERMISSION_GRANTED;
|
||||||
boolean hasDeletePermission =
|
boolean hasDeletePermission =
|
||||||
(getPackageManager().checkPermission(Manifest.permission.DELETE_PACKAGES, getPackageName())
|
getPackageManager().checkPermission(Manifest.permission.DELETE_PACKAGES, getPackageName())
|
||||||
== PackageManager.PERMISSION_GRANTED);
|
== PackageManager.PERMISSION_GRANTED;
|
||||||
|
|
||||||
return (hasInstallPermission && hasDeletePermission);
|
return hasInstallPermission && hasDeletePermission;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void installPackageImpl(Uri packageURI, int flags, String installerPackageName,
|
private void installPackageImpl(Uri packageURI, int flags, String installerPackageName,
|
||||||
|
@ -46,6 +46,7 @@
|
|||||||
<module name="TypecastParenPad" />
|
<module name="TypecastParenPad" />
|
||||||
<module name="WhitespaceAfter" />
|
<module name="WhitespaceAfter" />
|
||||||
<module name="WhitespaceAround" />
|
<module name="WhitespaceAround" />
|
||||||
|
<module name="UnnecessaryParentheses" />
|
||||||
|
|
||||||
<module name="ModifierOrder" />
|
<module name="ModifierOrder" />
|
||||||
<module name="RedundantModifier" />
|
<module name="RedundantModifier" />
|
||||||
@ -63,6 +64,7 @@
|
|||||||
<!--<module name="MissingSwitchDefault" />-->
|
<!--<module name="MissingSwitchDefault" />-->
|
||||||
|
|
||||||
<module name="FinalClass" />
|
<module name="FinalClass" />
|
||||||
|
|
||||||
<!--<module name="HideUtilityClassConstructor" />-->
|
<!--<module name="HideUtilityClassConstructor" />-->
|
||||||
<!--<module name="InterfaceIsType" />-->
|
<!--<module name="InterfaceIsType" />-->
|
||||||
<!--<module name="VisibilityModifier" />-->
|
<!--<module name="VisibilityModifier" />-->
|
||||||
|
Loading…
x
Reference in New Issue
Block a user