Fix various java warnings

Change-Id: I4c4381e1755831df2c4f41279800fd6af173e4ed
This commit is contained in:
Oliver Scott
2024-01-10 18:39:27 -05:00
committed by Michael Bestas
parent 7664461e5f
commit fd0fdb8a49
23 changed files with 156 additions and 444 deletions

View File

@@ -18,7 +18,6 @@
package org.lineageos.setupwizard.util;
import static android.content.Context.MODE_PRIVATE;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DEFAULT;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_DISABLED;
import static android.content.pm.PackageManager.COMPONENT_ENABLED_STATE_ENABLED;
import static android.content.pm.PackageManager.DONT_KILL_APP;
@@ -137,18 +136,6 @@ public class SetupWizardUtils {
return !featureHidden;
}
public static boolean isRadioReady(Context context, ServiceState state) {
final SetupWizardApp setupWizardApp = (SetupWizardApp) context.getApplicationContext();
if (setupWizardApp.isRadioReady()) {
return true;
} else {
final boolean ready = state != null
&& state.getState() != ServiceState.STATE_POWER_OFF;
setupWizardApp.setRadioReady(ready);
return ready;
}
}
public static boolean isOwner() {
return UserHandle.myUserId() == 0;
}
@@ -335,7 +322,7 @@ public class SetupWizardUtils {
COMPONENT_ENABLED_STATE_DISABLED);
}
public static void disableComponent(Context context, Class cls) {
public static void disableComponent(Context context, Class<?> cls) {
setComponentEnabledState(context, new ComponentName(context, cls),
COMPONENT_ENABLED_STATE_DISABLED);
}
@@ -345,16 +332,6 @@ public class SetupWizardUtils {
COMPONENT_ENABLED_STATE_ENABLED);
}
public static void resetComponentSets(Context context, int flags) {
setComponentListEnabledState(context, getComponentSets(context, flags),
COMPONENT_ENABLED_STATE_DEFAULT);
}
public static void resetComponent(Context context, Class<?> cls) {
setComponentEnabledState(context, new ComponentName(context, cls),
COMPONENT_ENABLED_STATE_DEFAULT);
}
public static void setComponentEnabledState(Context context, ComponentName componentName,
int enabledState) {
context.getPackageManager().setComponentEnabledSetting(componentName,
@@ -370,7 +347,7 @@ public class SetupWizardUtils {
public static List<ComponentName> getComponentSets(Context context, int flags) {
int i = 0;
List<ComponentName> componentNames = new ArrayList();
List<ComponentName> componentNames = new ArrayList<>();
try {
PackageInfo allInfo = context.getPackageManager()
.getPackageInfo(context.getPackageName(), flags);
@@ -394,7 +371,7 @@ public class SetupWizardUtils {
}
}
}
} catch (PackageManager.NameNotFoundException e) {
} catch (PackageManager.NameNotFoundException ignored) {
}
return componentNames;
}