miuicamera-dipper: Fix UnsatisfiedLinkError for libmiuinative

- Implement pure-Java miui.os.SystemProperties delegating directly to
  android.os.SystemProperties to avoid loading libmiuinative.so.
- Wrap System.loadLibrary in com.miui.internal.os.Native.<clinit>
  in try/catch block to prevent crash if library cannot be loaded.
- Include libmiuinative.so in proprietary blobs list.

Change-Id: I71e65ab584cb84b36a52afb9eab815cea565292b
This commit is contained in:
Raya Mahardika committed 2026-10-02 15:17:04 +00:00
1 parent 4352715056
commit 8ff2ec42a8
6 files changed
+496 -2

No files matched your search

@@ -159,6 +159,26 @@ index 00000000..57d86772
+
+ return-void
+.end method
diff --git a/smali_classes6/com/miui/internal/os/Native.smali b/smali_classes6/com/miui/internal/os/Native.smali
index fbaf0c4f..15131641 100644
--- a/smali_classes6/com/miui/internal/os/Native.smali
+++ b/smali_classes6/com/miui/internal/os/Native.smali
@@ -7,11 +7,15 @@
.method static constructor <clinit>()V
.locals 1
+ :try_start_0
const-string v0, "miuinative"
.line 1
invoke-static {v0}, Ljava/lang/System;->loadLibrary(Ljava/lang/String;)V
+ :try_end_0
+ .catchall {:try_start_0 .. :try_end_0} :catchall_0
+ :catchall_0
return-void
.end method
diff --git a/smali_classes8/miui/app/backup/BackupMeta.smali b/smali_classes8/miui/app/backup/BackupMeta.smali
new file mode 100644
index 00000000..c68b037d
@@ -9190,6 +9210,452 @@ index 00000000..969963dd
+ .line 358
+ return-void
+.end method
diff --git a/smali_classes8/miui/os/SystemProperties.smali b/smali_classes8/miui/os/SystemProperties.smali
index c316042c..69517ad8 100644
--- a/smali_classes8/miui/os/SystemProperties.smali
+++ b/smali_classes8/miui/os/SystemProperties.smali
@@ -23,7 +23,6 @@
.method static constructor <clinit>()V
.locals 1
- .line 1
new-instance v0, Ljava/util/ArrayList;
invoke-direct {v0}, Ljava/util/ArrayList;-><init>()V
@@ -34,338 +33,95 @@
.end method
.method protected constructor <init>()V
- .locals 1
+ .locals 2
.annotation system Ldalvik/annotation/Throws;
value = {
Ljava/lang/InstantiationException;
}
.end annotation
- .line 1
invoke-direct {p0}, Ljava/lang/Object;-><init>()V
- .line 2
- new-instance p0, Ljava/lang/InstantiationException;
+ new-instance v0, Ljava/lang/InstantiationException;
- const-string v0, "Cannot instantiate utility class"
+ const-string v1, "Cannot instantiate utility class"
- invoke-direct {p0, v0}, Ljava/lang/InstantiationException;-><init>(Ljava/lang/String;)V
+ invoke-direct {v0, v1}, Ljava/lang/InstantiationException;-><init>(Ljava/lang/String;)V
- throw p0
+ throw v0
.end method
.method public static addChangeCallback(Ljava/lang/Runnable;)V
- .locals 2
-
- .line 1
- sget-object v0, Lmiui/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList;
-
- monitor-enter v0
-
- .line 2
- :try_start_0
- sget-object v1, Lmiui/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList;
-
- invoke-virtual {v1}, Ljava/util/ArrayList;->size()I
-
- move-result v1
-
- if-nez v1, :cond_0
-
- .line 3
- const-class v1, Lmiui/os/SystemProperties;
-
- invoke-static {v1}, Lcom/miui/internal/os/Native;->addPropertyChangeCallbackNative(Ljava/lang/Class;)V
-
- .line 4
- :cond_0
- sget-object v1, Lmiui/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList;
-
- invoke-virtual {v1, p0}, Ljava/util/ArrayList;->add(Ljava/lang/Object;)Z
-
- .line 5
- monitor-exit v0
+ .locals 0
return-void
-
- :catchall_0
- move-exception p0
-
- monitor-exit v0
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
-
- throw p0
.end method
.method protected static callChangeCallbacks()V
- .locals 4
-
- .line 1
- sget-object v0, Lmiui/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList;
-
- monitor-enter v0
-
- .line 2
- :try_start_0
- sget-object v1, Lmiui/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList;
-
- invoke-virtual {v1}, Ljava/util/ArrayList;->size()I
-
- move-result v1
-
- if-nez v1, :cond_0
-
- .line 3
- monitor-exit v0
-
- return-void
-
- .line 4
- :cond_0
- new-instance v1, Ljava/util/ArrayList;
-
- sget-object v2, Lmiui/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList;
-
- invoke-direct {v1, v2}, Ljava/util/ArrayList;-><init>(Ljava/util/Collection;)V
-
- const/4 v2, 0x0
-
- .line 5
- :goto_0
- sget-object v3, Lmiui/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList;
-
- invoke-virtual {v3}, Ljava/util/ArrayList;->size()I
-
- move-result v3
-
- if-ge v2, v3, :cond_1
-
- .line 6
- invoke-virtual {v1, v2}, Ljava/util/ArrayList;->get(I)Ljava/lang/Object;
-
- move-result-object v3
-
- check-cast v3, Ljava/lang/Runnable;
-
- invoke-interface {v3}, Ljava/lang/Runnable;->run()V
-
- add-int/lit8 v2, v2, 0x1
-
- goto :goto_0
-
- .line 7
- :cond_1
- monitor-exit v0
+ .locals 0
return-void
-
- :catchall_0
- move-exception v1
-
- monitor-exit v0
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
-
- throw v1
.end method
.method public static get(Ljava/lang/String;)Ljava/lang/String;
- .locals 2
-
- .line 1
- invoke-virtual {p0}, Ljava/lang/String;->length()I
-
- move-result v0
-
- const/16 v1, 0x1f
-
- if-gt v0, v1, :cond_0
+ .locals 0
- .line 2
- invoke-static {p0}, Lcom/miui/internal/os/Native;->getPropertyNative(Ljava/lang/String;)Ljava/lang/String;
+ invoke-static {p0}, Landroid/os/SystemProperties;->get(Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
return-object p0
-
- .line 3
- :cond_0
- new-instance p0, Ljava/lang/IllegalArgumentException;
-
- const-string v0, "key.length > 31"
-
- invoke-direct {p0, v0}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
-
- throw p0
.end method
.method public static get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
- .locals 2
-
- .line 4
- invoke-virtual {p0}, Ljava/lang/String;->length()I
-
- move-result v0
-
- const/16 v1, 0x1f
-
- if-gt v0, v1, :cond_2
+ .locals 0
- .line 5
- invoke-static {p0}, Lcom/miui/internal/os/Native;->getPropertyNative(Ljava/lang/String;)Ljava/lang/String;
+ invoke-static {p0, p1}, Landroid/os/SystemProperties;->get(Ljava/lang/String;Ljava/lang/String;)Ljava/lang/String;
move-result-object p0
- if-eqz p0, :cond_0
-
- .line 6
- invoke-virtual {p0}, Ljava/lang/String;->length()I
-
- move-result v0
-
- if-nez v0, :cond_1
-
- :cond_0
- move-object p0, p1
-
- :cond_1
return-object p0
-
- .line 7
- :cond_2
- new-instance p0, Ljava/lang/IllegalArgumentException;
-
- const-string p1, "key.length > 31"
-
- invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
-
- throw p0
.end method
.method public static getBoolean(Ljava/lang/String;Z)Z
- .locals 2
-
- .line 1
- invoke-virtual {p0}, Ljava/lang/String;->length()I
-
- move-result v0
-
- const/16 v1, 0x1f
-
- if-gt v0, v1, :cond_0
+ .locals 0
- .line 2
- invoke-static {p0, p1}, Lcom/miui/internal/os/Native;->getBooleanPropertyNative(Ljava/lang/String;Z)Z
+ invoke-static {p0, p1}, Landroid/os/SystemProperties;->getBoolean(Ljava/lang/String;Z)Z
move-result p0
return p0
-
- .line 3
- :cond_0
- new-instance p0, Ljava/lang/IllegalArgumentException;
-
- const-string p1, "key.length > 31"
-
- invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
-
- throw p0
.end method
.method public static getInt(Ljava/lang/String;I)I
- .locals 2
-
- .line 1
- invoke-virtual {p0}, Ljava/lang/String;->length()I
-
- move-result v0
-
- const/16 v1, 0x1f
-
- if-gt v0, v1, :cond_0
+ .locals 0
- .line 2
- invoke-static {p0, p1}, Lcom/miui/internal/os/Native;->getIntPropertyNative(Ljava/lang/String;I)I
+ invoke-static {p0, p1}, Landroid/os/SystemProperties;->getInt(Ljava/lang/String;I)I
move-result p0
return p0
-
- .line 3
- :cond_0
- new-instance p0, Ljava/lang/IllegalArgumentException;
-
- const-string p1, "key.length > 31"
-
- invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
-
- throw p0
.end method
.method public static getLong(Ljava/lang/String;J)J
- .locals 2
-
- .line 1
- invoke-virtual {p0}, Ljava/lang/String;->length()I
-
- move-result v0
-
- const/16 v1, 0x1f
-
- if-gt v0, v1, :cond_0
+ .locals 0
- .line 2
- invoke-static {p0, p1, p2}, Lcom/miui/internal/os/Native;->getLongPropertyNative(Ljava/lang/String;J)J
+ invoke-static {p0, p1, p2}, Landroid/os/SystemProperties;->getLong(Ljava/lang/String;J)J
move-result-wide p0
return-wide p0
-
- .line 3
- :cond_0
- new-instance p0, Ljava/lang/IllegalArgumentException;
-
- const-string p1, "key.length > 31"
-
- invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
-
- throw p0
.end method
.method public static removeChangeCallback(Ljava/lang/Runnable;)V
- .locals 2
-
- .line 1
- sget-object v0, Lmiui/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList;
-
- monitor-enter v0
-
- .line 2
- :try_start_0
- sget-object v1, Lmiui/os/SystemProperties;->sChangeCallbacks:Ljava/util/ArrayList;
-
- invoke-virtual {v1, p0}, Ljava/util/ArrayList;->remove(Ljava/lang/Object;)Z
-
- .line 3
- monitor-exit v0
+ .locals 0
return-void
-
- :catchall_0
- move-exception p0
-
- monitor-exit v0
- :try_end_0
- .catchall {:try_start_0 .. :try_end_0} :catchall_0
-
- throw p0
.end method
.method public static set(Ljava/lang/String;I)V
.locals 0
- .line 6
invoke-static {p1}, Ljava/lang/Integer;->toString(I)Ljava/lang/String;
move-result-object p1
@@ -378,7 +134,6 @@
.method public static set(Ljava/lang/String;J)V
.locals 0
- .line 7
invoke-static {p1, p2}, Ljava/lang/Long;->toString(J)Ljava/lang/String;
move-result-object p1
@@ -389,62 +144,20 @@
.end method
.method public static set(Ljava/lang/String;Ljava/lang/String;)V
- .locals 2
-
- .line 1
- invoke-virtual {p0}, Ljava/lang/String;->length()I
-
- move-result v0
-
- const/16 v1, 0x1f
-
- if-gt v0, v1, :cond_2
-
- if-eqz p1, :cond_1
-
- .line 2
- invoke-virtual {p1}, Ljava/lang/String;->length()I
-
- move-result v0
-
- const/16 v1, 0x5b
-
- if-gt v0, v1, :cond_0
-
- goto :goto_0
-
- .line 3
- :cond_0
- new-instance p0, Ljava/lang/IllegalArgumentException;
-
- const-string p1, "val.length > 91"
-
- invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
-
- throw p0
+ .locals 0
- .line 4
- :cond_1
- :goto_0
- invoke-static {p0, p1}, Lcom/miui/internal/os/Native;->setPropertyNative(Ljava/lang/String;Ljava/lang/String;)V
+ :try_start_0
+ invoke-static {p0, p1}, Landroid/os/SystemProperties;->set(Ljava/lang/String;Ljava/lang/String;)V
+ :try_end_0
+ .catchall {:try_start_0 .. :try_end_0} :catchall_0
+ :catchall_0
return-void
-
- .line 5
- :cond_2
- new-instance p0, Ljava/lang/IllegalArgumentException;
-
- const-string p1, "key.length > 31"
-
- invoke-direct {p0, p1}, Ljava/lang/IllegalArgumentException;-><init>(Ljava/lang/String;)V
-
- throw p0
.end method
.method public static set(Ljava/lang/String;Z)V
.locals 0
- .line 8
invoke-static {p1}, Ljava/lang/Boolean;->toString(Z)Ljava/lang/String;
move-result-object p1
diff --git a/smali_classes8/miui/process/ForegroundInfo$1.smali b/smali_classes8/miui/process/ForegroundInfo$1.smali
new file mode 100644
index 00000000..d7ed5a7e