layerctl 0.2.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
layerctl/__init__.py ADDED
@@ -0,0 +1 @@
1
+ """layerctl — Android 層管理 (意志/観測/成果物のパッケージ本体)。"""
layerctl/__main__.py ADDED
@@ -0,0 +1,7 @@
1
+ """python3 -m layerctl の入口。layers shim (St1b で exec に切替) と
2
+ python3 -m layerctl.tui の双方と同じ tui.main 経路へ流す。
3
+ """
4
+ from .tui import main
5
+
6
+ if __name__ == "__main__":
7
+ raise SystemExit(main())
layerctl/core.py ADDED
@@ -0,0 +1,212 @@
1
+ #!/usr/bin/env python3
2
+ """venice/core - transport + env + batched metrics. non-root first, portable."""
3
+ import os
4
+ import shutil
5
+ import subprocess
6
+ import sys
7
+ import time
8
+
9
+ HOME = os.path.expanduser("~")
10
+ RISH = os.path.join(HOME, "rish")
11
+
12
+ class _T:
13
+ name = "?"
14
+ def ok(self): return False
15
+ def run(self, cmd, timeout=30):
16
+ r = subprocess.run(self.argv(cmd), text=True,
17
+ stderr=subprocess.STDOUT, timeout=timeout, stdout=subprocess.PIPE,
18
+ stdin=subprocess.DEVNULL, check=False)
19
+ return r.stdout
20
+
21
+ class Rish(_T):
22
+ name = "rish(Shizuku)"
23
+ def ok(self): return os.path.exists(RISH) and os.access(RISH, os.X_OK)
24
+ def argv(self, c): return [RISH, "-c", c]
25
+
26
+ class Adb(_T):
27
+ name = "adb"
28
+ def ok(self): return shutil.which("adb") is not None
29
+ def argv(self, c):
30
+ a = ["adb"]
31
+ dev = os.environ.get("ANDROID_SERIAL")
32
+ if dev:
33
+ a += ["-s", dev]
34
+ return [*a, "exec-out", c]
35
+ def run(self, cmd, timeout=30):
36
+ return super().run(cmd, timeout).replace("\r\n", "\n").replace("\r", "\n")
37
+
38
+ class Su(_T):
39
+ """root 経由。adb が居れば端末側の su を、居なければ同居の su を使う。
40
+ Termux 同居で強制するときは VENICE_SU_LOCAL=1。"""
41
+ name = "su(root)"
42
+ def _via_adb(self):
43
+ return os.environ.get("VENICE_SU_LOCAL") != "1" and shutil.which("adb") is not None
44
+ def ok(self):
45
+ return shutil.which("adb") is not None or shutil.which("su") is not None
46
+ def argv(self, c):
47
+ if not self._via_adb():
48
+ return ["su", "-c", c]
49
+ a = ["adb"]
50
+ dev = os.environ.get("ANDROID_SERIAL")
51
+ if dev:
52
+ a += ["-s", dev]
53
+ return [*a, "exec-out", "su -c '%s'" % c]
54
+ def run(self, cmd, timeout=30):
55
+ return super().run(cmd, timeout).replace("\r\n", "\n").replace("\r", "\n")
56
+
57
+ def detect(prefer=None):
58
+ prefer = prefer or os.environ.get("VENICE_TRANSPORT")
59
+ order = [Rish, Adb, Su]
60
+ if prefer == "adb": order = [Adb, Rish, Su]
61
+ elif prefer == "su": order = [Su, Rish, Adb]
62
+ for cls in order:
63
+ t = cls()
64
+ if t.ok(): return t
65
+ return None
66
+
67
+ ENV_CMD = ("getprop ro.product.model; getprop ro.product.device; "
68
+ "getprop ro.build.version.release; getprop ro.build.version.sdk; "
69
+ "getprop ro.board.platform; "
70
+ "settings get global development_settings_enabled; "
71
+ "settings get global adb_enabled; settings get global adb_wifi_enabled; "
72
+ "getprop init.svc.adbd; ps -A | grep -c shizuku; "
73
+ "pm list features | grep -c euicc; getprop ro.build.version.oneui")
74
+ ENV_KEYS = ["model","device","android","sdk","platform","devmode","adb","adbwifi",
75
+ "adbd","shizuku","euicc","oneui"]
76
+
77
+ def env(t):
78
+ out = t.run(ENV_CMD).splitlines()
79
+ out += [""] * (len(ENV_KEYS) - len(out))
80
+ d = dict(zip(ENV_KEYS, [x.strip() for x in out], strict=False))
81
+ d["root"] = "1" if t.run("command -v su || which su").strip() else "0"
82
+ d["adb_bin"] = "1" if shutil.which("adb") else "0"
83
+ d["rish"] = "1" if os.access(RISH, os.X_OK) else "0"
84
+ d["transport"] = t.name
85
+ return d
86
+
87
+ SNAP_CMD = ("cat /proc/meminfo; echo ==STAT==; head -1 /proc/stat; "
88
+ "echo ==NET==; cat /proc/net/dev; echo ==DF==; df -k /data; "
89
+ "echo ==LOAD==; cat /proc/loadavg; echo ==PROC==; ps -A | wc -l; "
90
+ "echo ==BATT==; dumpsys battery; echo ==ZRAM==; cat /sys/block/zram0/mm_stat")
91
+ MARKS = ("==STAT==", "==NET==", "==DF==", "==LOAD==", "==PROC==", "==BATT==", "==ZRAM==")
92
+
93
+ def _mark(x):
94
+ for m in MARKS:
95
+ if m in x:
96
+ return m
97
+ return None
98
+
99
+ def snapshot(t):
100
+ out = t.run(SNAP_CMD)
101
+ sec = "==MEM=="
102
+ s = {"mem": {}, "net": {}, "df": None, "load": "", "procs": 0,
103
+ "batt": {}, "stat": None, "zram": None, "misc": {}, "noise": [], "ts": time.time()}
104
+ for line in out.splitlines():
105
+ x = line.strip()
106
+ if not x:
107
+ continue
108
+ m = _mark(x)
109
+ if m:
110
+ sec = m
111
+ continue
112
+ if sec == "==MEM==":
113
+ if ":" in x:
114
+ k, v = x.split(":", 1)
115
+ f = v.split()
116
+ if f and f[0].isdigit():
117
+ s["mem"][k.strip()] = int(f[0])
118
+ elif f:
119
+ s["misc"][k.strip()] = f[0]
120
+ else:
121
+ s["noise"].append(x)
122
+ elif sec == "==STAT==":
123
+ f = x.split()
124
+ if f and f[0] == "cpu" and len(f) >= 6:
125
+ v = [int(i) for i in f[1:] if i.isdigit()]
126
+ if len(v) >= 5:
127
+ s["stat"] = (sum(v), v[3] + v[4])
128
+ else:
129
+ s["noise"].append(x)
130
+ elif sec == "==NET==":
131
+ if ":" in x:
132
+ k, rest = x.split(":", 1)
133
+ f = rest.split()
134
+ if len(f) >= 9 and f[0].isdigit() and f[8].isdigit():
135
+ s["net"][k.strip()] = (int(f[0]), int(f[8]))
136
+ elif sec == "==DF==":
137
+ f = x.split()
138
+ if len(f) >= 4 and f[0].startswith("/") and f[1].isdigit() and f[3].isdigit():
139
+ s["df"] = (int(f[1]), int(f[3]))
140
+ elif sec == "==LOAD==":
141
+ s["load"] = x
142
+ elif sec == "==PROC==":
143
+ if x.isdigit():
144
+ s["procs"] = int(x)
145
+ elif sec == "==BATT==":
146
+ if ":" in x:
147
+ k, v = x.split(":", 1)
148
+ s["batt"][k.strip()] = v.strip()
149
+ elif sec == "==ZRAM==":
150
+ f = x.split()
151
+ if len(f) >= 3 and all(i.isdigit() for i in f[:3]):
152
+ s["zram"] = (int(f[0]), int(f[1]), int(f[2]))
153
+ return s
154
+
155
+ def rates(p, c):
156
+ dt = max(0.001, c["ts"] - p["ts"])
157
+ rx = tx = 0
158
+ for i, (r, t) in c["net"].items():
159
+ if i in p["net"]:
160
+ pr, pt = p["net"][i]
161
+ if r >= pr: rx += r - pr
162
+ if t >= pt: tx += t - pt
163
+ cpu = None
164
+ if p.get("stat") and c.get("stat"):
165
+ dtot = c["stat"][0] - p["stat"][0]
166
+ didle = c["stat"][1] - p["stat"][1]
167
+ if dtot > 0:
168
+ cpu = 100.0 * (dtot - didle) / dtot
169
+ return {"rx_kbps": rx / dt * 8 / 1000.0, "tx_kbps": tx / dt * 8 / 1000.0, "cpu": cpu}
170
+
171
+ def mb(kb): return kb / 1024.0
172
+
173
+ PROBES = [
174
+ ("meminfo", "cat /proc/meminfo | wc -l"),
175
+ ("stat", "head -1 /proc/stat | wc -c"),
176
+ ("netdev", "cat /proc/net/dev | wc -l"),
177
+ ("df", "df -k /data | wc -l"),
178
+ ("loadavg", "cat /proc/loadavg"),
179
+ ("ps", "ps -A | wc -l"),
180
+ ("battery", "dumpsys battery | wc -l"),
181
+ ("zram", "cat /sys/block/zram0/mm_stat | wc -c"),
182
+ ("which", "which cat grep head df ps dumpsys sed"),
183
+ ]
184
+
185
+ def probe_all(t):
186
+ for name, c in PROBES:
187
+ try:
188
+ o = t.run(c, timeout=20).strip().replace("\n", " | ")
189
+ except Exception as e: # noqa: BLE001
190
+ o = "EXC " + repr(e)
191
+ print("%-9s %s" % (name, o[:80]))
192
+
193
+ if __name__ == "__main__":
194
+ t = detect()
195
+ if t is None:
196
+ print("no transport"); raise SystemExit(1)
197
+ if "--probe" in sys.argv:
198
+ probe_all(t)
199
+ elif "--raw" in sys.argv:
200
+ for i, l in enumerate(t.run(SNAP_CMD).splitlines()):
201
+ print("%3d %s" % (i, repr(l)))
202
+ elif "--json" in sys.argv:
203
+ import json
204
+ print(json.dumps({"env": env(t), "snap": snapshot(t)}, default=str, indent=2))
205
+ else:
206
+ print(t.name)
207
+ for k, v in env(t).items():
208
+ print(" %-10s %s" % (k, v))
209
+ s = snapshot(t)
210
+ print(" mem", s["mem"])
211
+ print(" misc", s["misc"])
212
+ print(" noise", s["noise"][:5])
@@ -0,0 +1,386 @@
1
+ # layer pkg action risk impact
2
+ D android root 3
3
+ B1 android.auto_generated_characteristics_rro restrict 1
4
+ B1 android.auto_generated_rro_product__ restrict 1
5
+ B1 android.auto_generated_rro_vendor__ restrict 1
6
+ C1 android.autoinstalls.config.google.nexus disable 1
7
+ D com.ai.venice root 3
8
+ 0 com.android.DeviceAsWebcam protect 3
9
+ C1 com.android.angle disable 1
10
+ A com.android.appsearch.aiseal.config none 1
11
+ B1 com.android.backupconfirm restrict 1
12
+ B1 com.android.bips restrict 1
13
+ C1 com.android.bips.auto_generated_rro_product__ disable 1
14
+ C1 com.android.bluetoothmidiservice disable 1
15
+ C1 com.android.bookmarkprovider disable 1
16
+ C1 com.android.calllogbackup disable 1
17
+ A com.android.cameraextensions none 1
18
+ C1 com.android.captiveportallogin.overlay disable 1
19
+ C1 com.android.carrierdefaultapp disable 1
20
+ 0 com.android.cellbroadcastreceiver protect 3
21
+ C1 com.android.cellbroadcastreceiver.overlay.pixel disable 1
22
+ C1 com.android.cellbroadcastservice.overlay.pixel disable 1
23
+ A com.android.certinstaller none 1
24
+ A com.android.chrome none 1
25
+ C1 com.android.companiondevicemanager disable 1
26
+ C1 com.android.companiondevicemanager.auto_generated_characteristics_rro disable 1
27
+ A com.android.contactspicker none 1
28
+ A com.android.credentialmanager none 1
29
+ C1 com.android.cts.ctsshim disable 1
30
+ B1 com.android.cts.priv.ctsshim restrict 1
31
+ C1 com.android.devicediagnostics disable 1
32
+ C1 com.android.devicediagnostics.auto_generated_rro_product__ disable 1
33
+ B1 com.android.devicediagnostics.auto_generated_rro_vendor__ restrict 1
34
+ C1 com.android.devicelockcontroller disable 1
35
+ C1 com.android.dreams.basic disable 1
36
+ 0 com.android.dynsystem protect 3
37
+ C1 com.android.egg disable 1
38
+ 0 com.android.emergency protect 3
39
+ B1 com.android.externalstorage restrict 1
40
+ A com.android.eyedropper none 1
41
+ C1 com.android.hbmsvmanager disable 1
42
+ C1 com.android.healthconnect.overlay disable 1
43
+ C1 com.android.hotwordenrollment.okgoogle disable 1
44
+ C1 com.android.hotwordenrollment.xgoogle disable 1
45
+ B1 com.android.htmlviewer restrict 1
46
+ 0 com.android.imsserviceentitlement protect 3
47
+ 0 com.android.inputdevices protect 3
48
+ B1 com.android.intentresolver restrict 1
49
+ C1 com.android.internal.display.cutout.emulation.avoidAppsInCutout disable 1
50
+ A com.android.internal.display.cutout.emulation.corner none 1
51
+ A com.android.internal.display.cutout.emulation.double none 1
52
+ A com.android.internal.display.cutout.emulation.hole none 1
53
+ A com.android.internal.display.cutout.emulation.noCutout none 1
54
+ A com.android.internal.display.cutout.emulation.tall none 1
55
+ A com.android.internal.display.cutout.emulation.waterfall none 1
56
+ B1 com.android.internal.systemui.navbar.gestural restrict 1
57
+ B1 com.android.internal.systemui.navbar.threebutton restrict 1
58
+ B1 com.android.internal.systemui.navbar.transparent restrict 1
59
+ 0 com.android.keychain protect 3
60
+ 0 com.android.localtransport protect 3
61
+ 0 com.android.location.fused protect 3
62
+ B1 com.android.managedprovisioning restrict 1
63
+ C1 com.android.managedprovisioning.overlay disable 1
64
+ 0 com.android.mms.service protect 3
65
+ A com.android.mtp none 1
66
+ A com.android.multiuser none 1
67
+ C1 com.android.musicfx disable 1
68
+ A com.android.networkstack.overlay none 1
69
+ 0 com.android.nfc protect 3
70
+ B1 com.android.nfc.overlay restrict 1
71
+ C1 com.android.omadm.service disable 1
72
+ C1 com.android.omadm.service.auto_generated_rro_product__ disable 1
73
+ C1 com.android.omadm.service.auto_generated_rro_vendor__ disable 1
74
+ 0 com.android.ons protect 3
75
+ A com.android.ons.auto_generated_rro_vendor__ none 1
76
+ B1 com.android.pacprocessor restrict 1
77
+ 0 com.android.phone protect 3
78
+ C1 com.android.phone.auto_generated_characteristics_rro disable 1
79
+ A com.android.phone.auto_generated_rro_product__ none 1
80
+ A com.android.phone.auto_generated_rro_vendor__ none 1
81
+ B1 com.android.printspooler restrict 1
82
+ B1 com.android.providers.blockednumber restrict 1
83
+ 0 com.android.providers.calendar protect 3
84
+ C1 com.android.providers.contactkeys disable 1
85
+ 0 com.android.providers.contacts protect 3
86
+ C1 com.android.providers.contacts.auto_generated_rro_product__ disable 1
87
+ 0 com.android.providers.downloads protect 3
88
+ C1 com.android.providers.downloads.ui disable 1
89
+ C1 com.android.providers.media.overlay.pixel disable 1
90
+ C1 com.android.providers.partnerbookmarks disable 1
91
+ 0 com.android.providers.settings protect 3
92
+ C1 com.android.providers.settings.auto_generated_rro_product__ disable 1
93
+ 0 com.android.providers.telephony protect 3
94
+ C1 com.android.providers.telephony.auto_generated_characteristics_rro disable 1
95
+ A com.android.providers.telephony.auto_generated_rro_product__ none 1
96
+ B1 com.android.providers.userdictionary restrict 1
97
+ 0 com.android.proxyhandler protect 3
98
+ C1 com.android.role.notes.enabled disable 1
99
+ C1 com.android.safetyregulatoryinfo disable 1
100
+ C1 com.android.safetyregulatoryinfo.auto_generated_rro_product__ disable 1
101
+ C1 com.android.sdm.plugins.connmo disable 1
102
+ C1 com.android.sdm.plugins.dcmo disable 1
103
+ C1 com.android.sdm.plugins.diagmon disable 1
104
+ 0 com.android.se protect 3
105
+ 0 com.android.server.telecom protect 3
106
+ 0 com.android.settings protect 3
107
+ A com.android.settings.auto_generated_rro_product__ none 1
108
+ A com.android.settings.auto_generated_rro_vendor__ none 1
109
+ A com.android.settings.identitychecksettingsoverlay none 1
110
+ A com.android.settings.overlay.gf5kq none 1
111
+ A com.android.settings.overlay.raven none 1
112
+ C1 com.android.sharedstoragebackup disable 1
113
+ 0 com.android.shell protect 3
114
+ B1 com.android.simappdialog restrict 1
115
+ C1 com.android.simappdialog.auto_generated_rro_product__ disable 1
116
+ B1 com.android.soundpicker restrict 1
117
+ 0 com.android.stk protect 3
118
+ D com.android.systemui root 3 ステータスバー / 通知 / 壁紙描画
119
+ C1 com.android.systemui.accessibility.accessibilitymenu disable 1
120
+ C1 com.android.systemui.accessibility.accessibilitymenu.auto_generated_rro_product__ disable 1
121
+ A com.android.systemui.auto_generated_rro_product__ none 1
122
+ A com.android.systemui.auto_generated_rro_vendor__ none 1
123
+ C1 com.android.systemui.clocks.bignum disable 1
124
+ C1 com.android.systemui.clocks.calligraphy disable 1
125
+ C1 com.android.systemui.clocks.growth disable 1
126
+ B1 com.android.systemui.clocks.inflate restrict 1
127
+ A com.android.systemui.clocks.metro none 1
128
+ C1 com.android.systemui.clocks.numoverlap disable 1
129
+ C1 com.android.systemui.clocks.weather disable 1
130
+ C1 com.android.systemui.plugin.globalactions.wallet disable 1
131
+ C1 com.android.theme.font.notoserifsource disable 1
132
+ C1 com.android.traceur disable 1
133
+ C1 com.android.traceur.auto_generated_rro_product__ disable 1
134
+ C1 com.android.traceur.auto_generated_rro_vendor__ disable 1
135
+ 0 com.android.vending protect 3 Playストア
136
+ A com.android.virtualdevicemanager none 1
137
+ A com.android.virtualdevicemanager.auto_generated_characteristics_rro none 1
138
+ C1 com.android.virtualization.terminal disable 1
139
+ B1 com.android.vpndialogs restrict 1
140
+ A com.android.wallpaper.livepicker none 1
141
+ C1 com.android.wallpaperbackup disable 1
142
+ B2 com.brave.browser frequent 1
143
+ B2 com.chachastation.app frequent 1
144
+ B2 com.dena.automotive.taxibell frequent 1
145
+ C1 com.facebook.katana disable 1
146
+ 0 com.felicanetworks.mfc protect 3
147
+ 0 com.felicanetworks.mfm.main protect 3
148
+ 0 com.felicanetworks.mfs protect 3
149
+ 0 com.felicanetworks.mfw.a.boot protect 3
150
+ B1 com.fitbit.FitbitMobile restrict 1
151
+ C1 com.google.SSRestartDetector disable 1
152
+ C1 com.google.ambient.streaming disable 1
153
+ C1 com.google.android.GoogleCamera disable 1
154
+ C1 com.google.android.accessibility.soundamplifier disable 1
155
+ C1 com.google.android.accessibility.switchaccess disable 1
156
+ C1 com.google.android.adservices.api disable 1
157
+ C1 com.google.android.aicore disable 1
158
+ C1 com.google.android.apps.accessibility.voiceaccess disable 1
159
+ A com.google.android.apps.ai.icons none 1
160
+ A com.google.android.apps.authenticator2 none 1
161
+ B1 com.google.android.apps.camera.services restrict 1
162
+ C1 com.google.android.apps.carrier.carrierwifi disable 1
163
+ C1 com.google.android.apps.carrier.log disable 1
164
+ C1 com.google.android.apps.cbrsnetworkmonitor disable 1
165
+ C1 com.google.android.apps.chromecast.app disable 1
166
+ B1 com.google.android.apps.customization.pixel restrict 1
167
+ C1 com.google.android.apps.diagnosticstool disable 1
168
+ B1 com.google.android.apps.docs restrict 1
169
+ B1 com.google.android.apps.docs.editors.docs restrict 1
170
+ B1 com.google.android.apps.docs.editors.sheets restrict 1
171
+ B1 com.google.android.apps.docs.editors.slides restrict 1
172
+ C1 com.google.android.apps.dreamliner disable 1
173
+ A com.google.android.apps.emojiwallpaper none 1
174
+ C1 com.google.android.apps.healthdata disable 1
175
+ C1 com.google.android.apps.internal.betterbug disable 1
176
+ C1 com.google.android.apps.kids.familylinkhelper disable 1
177
+ A com.google.android.apps.magicportrait none 1
178
+ A com.google.android.apps.maps none 1
179
+ 0 com.google.android.apps.messaging protect 3 SMSの受け皿。認証コードが届く
180
+ B1 com.google.android.apps.nbu.files restrict 1
181
+ 0 com.google.android.apps.nexuslauncher protect 3 Pixel Launcher。ホーム
182
+ B1 com.google.android.apps.photos restrict 1 Googleフォト
183
+ C1 com.google.android.apps.pixel.creativeassistant disable 1
184
+ A com.google.android.apps.pixel.customizationbundle none 1
185
+ A com.google.android.apps.pixel.dcservice none 1
186
+ B1 com.google.android.apps.pixel.nowplaying restrict 1
187
+ A com.google.android.apps.pixel.relationships none 1
188
+ C1 com.google.android.apps.pixel.support disable 1
189
+ C1 com.google.android.apps.recorder disable 1
190
+ C1 com.google.android.apps.restore disable 1
191
+ C1 com.google.android.apps.safetyhub disable 1
192
+ C1 com.google.android.apps.scone disable 1
193
+ A com.google.android.apps.scone.overlays none 1
194
+ C1 com.google.android.apps.setupwizard.searchselector disable 1
195
+ B1 com.google.android.apps.subscriptions.red restrict 1 Google One
196
+ C1 com.google.android.apps.tachyon disable 1
197
+ C1 com.google.android.apps.tasks disable 1
198
+ B1 com.google.android.apps.tips restrict 1
199
+ 0 com.google.android.apps.turbo protect 3 Adaptive Battery。bucket を書き戻す
200
+ C1 com.google.android.apps.walletnfcrel disable 1
201
+ 0 com.google.android.apps.wallpaper protect 3 壁紙ピッカー
202
+ C1 com.google.android.apps.wallpaper.pixel disable 1
203
+ C1 com.google.android.apps.weather disable 1
204
+ C1 com.google.android.apps.wellbeing disable 1
205
+ C1 com.google.android.apps.work.clouddpc disable 1
206
+ C2 com.google.android.apps.work.oobconfig restrict 3
207
+ C1 com.google.android.apps.youtube.music disable 1
208
+ B1 com.google.android.appsearch.apk restrict 1
209
+ C1 com.google.android.as disable 1
210
+ C1 com.google.android.as.oss disable 1
211
+ C1 com.google.android.avatarpicker disable 1
212
+ 0 com.google.android.bluetooth protect 3
213
+ C1 com.google.android.calculator disable 1
214
+ C1 com.google.android.calendar disable 1
215
+ A com.google.android.captiveportallogin none 1
216
+ 0 com.google.android.carrier protect 3
217
+ B1 com.google.android.carrierlocation restrict 1
218
+ C1 com.google.android.carriersetup disable 1
219
+ 0 com.google.android.cellbroadcastreceiver protect 3
220
+ 0 com.google.android.cellbroadcastservice protect 3
221
+ B1 com.google.android.compos.payload restrict 1
222
+ B1 com.google.android.configupdater restrict 1
223
+ A com.google.android.connectivity.resources none 1
224
+ B1 com.google.android.connectivity.resources.overlay restrict 1
225
+ 0 com.google.android.connectivitythermalpowermanager protect 3
226
+ B1 com.google.android.contactkeys restrict 1
227
+ A com.google.android.contacts none 1
228
+ C1 com.google.android.deskclock disable 1
229
+ 0 com.google.android.dialer protect 3 電話。着信
230
+ A com.google.android.documentsui none 1
231
+ C1 com.google.android.documentsui.theme.pixel disable 1
232
+ C1 com.google.android.dreamlinerupdater disable 1
233
+ B1 com.google.android.euicc restrict 1
234
+ C1 com.google.android.euiccoverlay disable 1
235
+ A com.google.android.ext.services none 1
236
+ A com.google.android.ext.shared none 1
237
+ C1 com.google.android.factoryota disable 1
238
+ C1 com.google.android.federatedcompute disable 1
239
+ C1 com.google.android.feedback disable 1
240
+ 0 com.google.android.flipendo protect 3
241
+ A com.google.android.flipendo.auto_generated_rro_product__ none 1
242
+ A com.google.android.flipendo.auto_generated_rro_vendor__ none 1
243
+ C1 com.google.android.glasses.core disable 1
244
+ A com.google.android.gm none 1 Gmail
245
+ 0 com.google.android.gms protect 3 FCM / 認証 / 位置。触るな
246
+ C1 com.google.android.gms.location.history disable 1
247
+ C1 com.google.android.gms.pay.sidecar disable 1
248
+ C1 com.google.android.gms.supervision disable 1
249
+ C1 com.google.android.googlequicksearchbox disable 2 Googleアプリ / 検索
250
+ C1 com.google.android.googlequicksearchbox.nga_resources disable 1
251
+ C1 com.google.android.grilservice disable 1
252
+ B1 com.google.android.gsf restrict 1
253
+ C1 com.google.android.hardwareinfo disable 1
254
+ C1 com.google.android.health.connect.backuprestore disable 1
255
+ C1 com.google.android.healthconnect.controller disable 1
256
+ C1 com.google.android.hotspot2.osulogin disable 1
257
+ 0 com.google.android.inputmethod.latin protect 3 Gboard。既定IME
258
+ 0 com.google.android.iwlan protect 3
259
+ A com.google.android.keep none 1
260
+ C1 com.google.android.markup disable 1
261
+ C1 com.google.android.marvin.talkback disable 1
262
+ C1 com.google.android.microdroid.empty_payload disable 1
263
+ A com.google.android.modulemetadata none 1
264
+ 0 com.google.android.networkstack protect 3
265
+ 0 com.google.android.networkstack.tethering protect 3
266
+ B1 com.google.android.networkstack.tethering.overlay2021 restrict 1
267
+ 0 com.google.android.nfc protect 3
268
+ A com.google.android.nfc.overlay none 1
269
+ A com.google.android.nfc.overlay.common none 1
270
+ C1 com.google.android.odad disable 1
271
+ C1 com.google.android.ondevicepersonalization.services disable 1
272
+ A com.google.android.overlay.DeviceAsWebcam none 1
273
+ B1 com.google.android.overlay.devicelockcontroller restrict 1
274
+ A com.google.android.overlay.glanceablehubconfig none 1
275
+ A com.google.android.overlay.glanceablehubsettings none 1
276
+ A com.google.android.overlay.googleconfig none 1
277
+ A com.google.android.overlay.googlewebview none 1
278
+ A com.google.android.overlay.messagingreadrestrictionallowlist none 1
279
+ C1 com.google.android.overlay.permissioncontroller disable 1
280
+ A com.google.android.overlay.permissioncontroller.safetycenter none 1
281
+ A com.google.android.overlay.pixelconfig2018 none 1
282
+ A com.google.android.overlay.pixelconfig2019 none 1
283
+ A com.google.android.overlay.pixelconfig2019midyear none 1
284
+ B1 com.google.android.overlay.pixelconfig2021 restrict 1
285
+ A com.google.android.overlay.pixelconfigcommon none 1
286
+ C1 com.google.android.overlay.udfpsoverlay disable 1
287
+ A com.google.android.packageinstaller none 1
288
+ C1 com.google.android.partnersetup disable 1
289
+ A com.google.android.pcs none 1
290
+ A com.google.android.permissioncontroller none 1
291
+ B1 com.google.android.photopicker restrict 1
292
+ C1 com.google.android.pixel.avatarpicker disable 1
293
+ C1 com.google.android.pixel.setupwizard disable 1
294
+ A com.google.android.pixel.setupwizard.overlay.expressive none 1
295
+ C1 com.google.android.pixelnfc disable 1
296
+ A com.google.android.pixelsystemservice none 1
297
+ C1 com.google.android.printservice.recommendation disable 1
298
+ C1 com.google.android.projection.gearhead disable 1
299
+ B1 com.google.android.providers.media.module restrict 1
300
+ C1 com.google.android.repairmode disable 1
301
+ 0 com.google.android.rkpdapp protect 3
302
+ B1 com.google.android.safetycenter.resources restrict 1
303
+ B1 com.google.android.safetycore restrict 1
304
+ A com.google.android.sdksandbox none 1
305
+ C1 com.google.android.settings.intelligence disable 1
306
+ C1 com.google.android.setupwizard disable 1
307
+ A com.google.android.signature none 1
308
+ C1 com.google.android.soundpicker disable 1
309
+ B1 com.google.android.storagemanager restrict 1
310
+ A com.google.android.storagemanager.auto_generated_rro_product__ none 1
311
+ A com.google.android.storagemanager.auto_generated_rro_vendor__ none 1
312
+ A com.google.android.systemui.gxoverlay none 1
313
+ A com.google.android.systemui.overlay.glanceablehubconfig none 1
314
+ B1 com.google.android.systemui.overlay.pixelbatteryhealthconfig restrict 1
315
+ C1 com.google.android.tag disable 1
316
+ A com.google.android.telecomresources none 1
317
+ A com.google.android.telecomresources.deprecated.overlay none 1
318
+ A com.google.android.telecomresources.overlay none 1
319
+ A com.google.android.telecomui none 1
320
+ 0 com.google.android.telephony protect 3
321
+ C1 com.google.android.tetheringentitlement disable 1
322
+ A com.google.android.tts none 1
323
+ C1 com.google.android.turboadapter disable 1
324
+ C1 com.google.android.uvexposurereporter disable 1
325
+ B1 com.google.android.uwb.resources restrict 1
326
+ A com.google.android.uwb.resources.pixel none 1
327
+ A com.google.android.verifier none 1
328
+ A com.google.android.verifier.overlay none 1
329
+ C1 com.google.android.videos disable 1
330
+ C1 com.google.android.virtualmachine.res disable 1
331
+ C1 com.google.android.wallpaper.effects disable 1
332
+ A com.google.android.webapp.service none 1
333
+ B1 com.google.android.webview restrict 1
334
+ C1 com.google.android.wfcactivation disable 1
335
+ B1 com.google.android.wifi.dialog restrict 1
336
+ A com.google.android.wifi.resources none 1
337
+ A com.google.android.wifi.resources.pixel none 1
338
+ B1 com.google.android.youtube restrict 1 YouTube
339
+ C1 com.google.ar.core disable 1
340
+ A com.google.assistant.hubui none 1
341
+ C1 com.google.audio.hearing.visualization.accessibility.scribe disable 1
342
+ C1 com.google.euiccpixel disable 1
343
+ C1 com.google.euiccpixel.overlay.gs101 disable 1
344
+ B1 com.google.euiccpixel.permissions restrict 1
345
+ C1 com.google.mainline.adservices disable 1
346
+ C1 com.google.mainline.telemetry disable 1
347
+ C1 com.google.omadm.trigger disable 1
348
+ C1 com.google.pixel.camera.services disable 1
349
+ C1 com.google.pixel.digitalkey.timesync disable 1
350
+ C1 com.google.pixel.livewallpaper disable 1
351
+ B2 com.izzle.go frequent 1
352
+ B1 com.kick.mobile restrict 1
353
+ B2 com.kick.streaming frequent 1
354
+ B2 com.mercuryo.app frequent 1
355
+ C1 com.microsoft.office.word disable 1
356
+ A com.mobilepasmo.android none 1
357
+ A com.northcube.sleepcycle none 1
358
+ B1 com.openai.chatgpt restrict 1
359
+ B1 com.picsart.studio restrict 1
360
+ B1 com.qorvo.uwb.vendorservice restrict 1
361
+ 0 com.samsung.slsi.telephony.oem.oemrilhookservice protect 3
362
+ B1 com.samsung.slsi.telephony.oemril restrict 1
363
+ C1 com.shannon.imsservice disable 1
364
+ C1 com.shannon.qualifiednetworksservice disable 1
365
+ C1 com.shannon.rcsservice disable 1
366
+ 0 com.termux protect 3
367
+ B1 com.termux.api restrict 1
368
+ A com.topjohnwu.magisk none 1
369
+ B1 com.twoheadedshark.tco restrict 1
370
+ C1 com.verizon.mips.services disable 1
371
+ C1 com.verizon.services disable 1
372
+ C1 com.vzw.apnlib disable 1
373
+ A gr.nikolasspyr.integritycheck none 1
374
+ B1 io.github.a13e300.ksuwebui restrict 1
375
+ B1 io.github.a13e300.tricky_store restrict 1
376
+ B1 io.github.vvb2060.keyattestation restrict 1
377
+ A jp.co.jorudan.nrkj none 1
378
+ 0 jp.co.rakuten.mobile.rcs protect 3 Rakuten Link。着信。層0必須
379
+ B1 jp.kanmu.vandle.android restrict 1
380
+ B2 jp.mixi.minimo frequent 1
381
+ 0 jp.naver.line.android protect 3 LINE。通知が生命線
382
+ B2 jp.unext.mediaplayer frequent 1
383
+ B1 me.zhanghai.android.files restrict 1
384
+ 0 moe.shizuku.privileged.api protect 3
385
+ B1 org.torproject.android restrict 1
386
+ B1 org.torproject.torbrowser restrict 1
layerctl/importers.py ADDED
@@ -0,0 +1,63 @@
1
+ """外部の debloat リストを取り込む。パースだけを担い、層への写像は tui 側。
2
+
3
+ 対応形式(中身で自動判定):
4
+ - UAD JSON : universal-android-debloater-next-generation の uad_lists.json
5
+ - 簡易 TSV : 'pkg<TAB>verdict'。verdict は recommended/advanced/expert/unsafe
6
+ - プレーン : 1行1パッケージ。'#' から行末までコメント
7
+
8
+ 外部ツールの語彙をそのまま持ち込まず、'verdict' という1つの語に正規化する。
9
+ """
10
+ import json
11
+ import re
12
+
13
+ PKG = re.compile(r"^\w+(\.\w+)*$")
14
+
15
+
16
+ def _clean(line):
17
+ return line.split("#", 1)[0].strip()
18
+
19
+
20
+ def parse_plain(text):
21
+ out = {}
22
+ for line in text.splitlines():
23
+ cl = _clean(line)
24
+ if not cl:
25
+ continue
26
+ pkg = cl.split()[0]
27
+ if PKG.match(pkg):
28
+ out[pkg] = ""
29
+ return out
30
+
31
+
32
+ def parse_tsv(text):
33
+ out = {}
34
+ for line in text.splitlines():
35
+ cl = _clean(line)
36
+ if not cl:
37
+ continue
38
+ c = cl.split("\t")
39
+ pkg = c[0].strip()
40
+ if not PKG.match(pkg):
41
+ continue
42
+ out[pkg] = (c[1].strip().lower() if len(c) > 1 else "")
43
+ return out
44
+
45
+
46
+ def parse_uad_json(text):
47
+ d = json.loads(text)
48
+ out = {}
49
+ for pkg, v in d.items():
50
+ if not isinstance(v, dict) or not PKG.match(pkg):
51
+ continue
52
+ out[pkg] = str(v.get("removal", "")).strip().lower()
53
+ return out
54
+
55
+
56
+ def load(path):
57
+ with open(path, encoding="utf-8", errors="replace") as f:
58
+ text = f.read()
59
+ if path.endswith(".json") or text.lstrip()[:1] == "{":
60
+ return parse_uad_json(text)
61
+ if "\t" in text:
62
+ return parse_tsv(text)
63
+ return parse_plain(text)