mirror of
https://github.com/chararomandroid/android_device_samsung_a20
synced 2026-08-23 12:35:33 -04:00
universal7885: Address SELinux denials
* Now boots with enforcing kernel
This commit is contained in:
parent
c7f80dea23
commit
7329c87196
17 changed files with 50 additions and 30 deletions
|
|
@ -16,14 +16,3 @@ Java_com_eurekateam_samsungextras_interfaces_SELinux_getSELinux(JNIEnv *env, jcl
|
|||
int ret = service->readSELinuxstats();
|
||||
return ret;
|
||||
}
|
||||
extern "C"
|
||||
JNIEXPORT void JNICALL
|
||||
Java_com_eurekateam_samsungextras_interfaces_SELinux_setSELinux(JNIEnv *env, jclass clazz,
|
||||
jint enable) {
|
||||
android::sp<ISELinux> service = ISELinux::getService();
|
||||
if (enable == 1){
|
||||
service->setSELinuxWritable(Enable::ENABLE);
|
||||
}else{
|
||||
service->setSELinuxWritable(Enable::DISABLE);
|
||||
}
|
||||
}
|
||||
|
|
@ -23,7 +23,7 @@ import android.content.SharedPreferences;
|
|||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import com.eurekateam.samsungextras.utils.FileUtilsWrapper;
|
||||
import com.eurekateam.samsungextras.interfaces.GPU;
|
||||
|
||||
|
||||
public class BootReceiver extends BroadcastReceiver {
|
||||
|
|
@ -37,7 +37,7 @@ public class BootReceiver extends BroadcastReceiver {
|
|||
}
|
||||
boolean gpuenabled = sharedPrefs.getBoolean(DeviceSettings.PREF_GPUEXYNOS, false);
|
||||
if (!gpuenabled){
|
||||
FileUtilsWrapper.writeLine(GlobalConstants.TMU_SYSFS, "0");
|
||||
GPU.setGPU(0);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,10 +69,15 @@ public class DeviceSettings extends PreferenceFragment implements
|
|||
mGPUExynos.setChecked(GPU.getGPU() == 1);
|
||||
mGPUExynos.setOnPreferenceChangeListener(this);
|
||||
|
||||
SwitchPreference mSELinux = findPreference(PREF_SELINUX);
|
||||
Preference mSELinux = findPreference(PREF_SELINUX);
|
||||
assert mSELinux != null;
|
||||
mSELinux.setOnPreferenceChangeListener(this);
|
||||
mSELinux.setEnabled(SELinux.getSELinux() != 0);
|
||||
mSELinux.setOnPreferenceClickListener(preference -> {
|
||||
Toast.makeText(getContext(), SELinux.getSELinux() == 1 ?
|
||||
"SELinux is in enforcing state." :
|
||||
"SELinux is in permissive state.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
return true;
|
||||
});
|
||||
|
||||
Preference mFlashLight = findPreference(PREF_FLASHLIGHT);
|
||||
assert mFlashLight != null;
|
||||
|
|
@ -109,12 +114,6 @@ public class DeviceSettings extends PreferenceFragment implements
|
|||
Toast.makeText(getContext(), gpu_enabled ? "GPU Throttling is now enabled."
|
||||
: "GPU Throttling is now disabled.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
case PREF_SELINUX:
|
||||
boolean selinux_enabled = (Boolean) value;
|
||||
SELinux.setSELinux(selinux_enabled ? 1 : 0);
|
||||
Toast.makeText(getContext(), selinux_enabled ? "SELinux is now in enforcing state."
|
||||
: "SELinux is now in permissive state.",
|
||||
Toast.LENGTH_SHORT).show();
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -69,12 +69,12 @@ public class BatteryFragment extends PreferenceFragment implements
|
|||
if (preference == mChargePref) {
|
||||
Boolean value = (Boolean) newValue;
|
||||
Battery.setChargeSysfs(value ? 0 : 1 );
|
||||
mFastChargePref.setChecked(Battery.getChargeSysfs() == 0);
|
||||
mChargePref.setChecked(Battery.getChargeSysfs() == 0);
|
||||
return true;
|
||||
}else if (preference == mFastChargePref){
|
||||
Boolean value = (Boolean) newValue;
|
||||
Battery.setFastCharge(value ? 0 : 1 );
|
||||
mChargePref.setChecked(Battery.getFastChargeSysfs() == 0);
|
||||
mFastChargePref.setChecked(Battery.getFastChargeSysfs() == 0);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package com.eurekateam.samsungextras.interfaces;
|
||||
|
||||
public class SELinux {
|
||||
public static native void setSELinux(int enable);
|
||||
public static native int getSELinux();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue