mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-03-16 06:48:49 -07:00
Compare commits
1 Commits
vvb2060-pa
...
compact
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
ecc4e1b7b2 |
@@ -27,6 +27,8 @@ struct ResetProp {
|
||||
context: bool,
|
||||
#[argh(switch, short = 'n', long = none)]
|
||||
skip_svc: bool,
|
||||
#[argh(switch, short = 'c', long = "compact")]
|
||||
compact: bool,
|
||||
#[argh(option, short = 'f')]
|
||||
file: Option<Utf8CString>,
|
||||
#[argh(option, short = 'd', long = "delete")]
|
||||
@@ -59,6 +61,7 @@ General flags:
|
||||
-h,--help show this message
|
||||
-v,--verbose print verbose output to stderr
|
||||
-w switch to wait mode
|
||||
-c,--compact compact property area
|
||||
|
||||
Read mode flags:
|
||||
-p also read persistent properties from storage
|
||||
@@ -177,6 +180,11 @@ impl ResetProp {
|
||||
ret
|
||||
}
|
||||
|
||||
fn compact(&self) -> bool {
|
||||
debug!("resetprop: compact property area");
|
||||
SYS_PROP.compact()
|
||||
}
|
||||
|
||||
fn wait(&self) {
|
||||
let key = &self.args[0];
|
||||
let val = self.args.get(1).map(|s| &**s);
|
||||
@@ -227,7 +235,11 @@ impl ResetProp {
|
||||
}
|
||||
|
||||
fn run(self) -> LoggedResult<()> {
|
||||
if self.wait_mode {
|
||||
if self.compact {
|
||||
if !self.compact() {
|
||||
return log_err!();
|
||||
}
|
||||
} else if self.wait_mode {
|
||||
self.wait();
|
||||
} else if let Some(file) = &self.file {
|
||||
self.load_file(file)?;
|
||||
@@ -269,6 +281,9 @@ pub fn resetprop_main(argc: i32, argv: *mut *mut c_char) -> i32 {
|
||||
}
|
||||
special_mode += 1;
|
||||
}
|
||||
if cli.compact {
|
||||
special_mode += 1;
|
||||
}
|
||||
if cli.file.is_some() {
|
||||
special_mode += 1;
|
||||
}
|
||||
|
||||
@@ -82,6 +82,8 @@ unsafe extern "C" {
|
||||
fn sys_prop_delete(key: CharPtr, prune: bool) -> i32;
|
||||
#[link_name = "__system_property_get_context"]
|
||||
fn sys_prop_get_context(key: CharPtr) -> CharPtr;
|
||||
#[link_name = "__system_property_compact"]
|
||||
fn sys_prop_compact() -> bool;
|
||||
#[link_name = "__system_property_area_serial2"]
|
||||
fn sys_prop_area_serial() -> u32;
|
||||
}
|
||||
@@ -175,6 +177,10 @@ impl SysProp {
|
||||
unsafe { Utf8CStr::from_ptr_unchecked(sys_prop_get_context(key.as_ptr())) }
|
||||
}
|
||||
|
||||
fn compact(&self) -> bool {
|
||||
unsafe { sys_prop_compact() }
|
||||
}
|
||||
|
||||
fn area_serial(&self) -> u32 {
|
||||
unsafe { sys_prop_area_serial() }
|
||||
}
|
||||
|
||||
2
native/src/external/system_properties
vendored
2
native/src/external/system_properties
vendored
Submodule native/src/external/system_properties updated: b7c2088565...2f9263d578
Reference in New Issue
Block a user