├── README.md ├── base_jars ├── apk │ └── com │ │ └── android │ │ └── server │ │ └── am │ │ ├── ActivityManagerService.smali │ │ ├── PreventRunning.smali │ │ ├── PreventRunningHook.smali │ │ └── PreventRunningUtils.smali ├── apk_oreo │ └── com │ │ └── android │ │ └── server │ │ └── am │ │ ├── ActivityManagerService.smali │ │ ├── ActivityStackSupervisor.smali │ │ ├── PreventRunning.smali │ │ ├── PreventRunningHook.smali │ │ └── PreventRunningUtils.smali ├── baksmali.jar ├── compact_dex_converter_linux_32 ├── cyggcc_s-seh-1.dll ├── cygwin1.dll ├── cygz.dll ├── flinux.exe ├── hy.apk ├── hy_oreo.apk ├── oat2dex.jar ├── patch.py ├── patch_oreo.py ├── smali.jar └── vdexExtractor.exe ├── config ├── prevent_server.jar └── start.bat /README.md: -------------------------------------------------------------------------------- 1 | # 黑域一键补丁windows服务端 2 | - 版本v0.3beta 3 | ## 搭建方法 4 | ### 原料 5 | - 一台windows服务器 6 | - python环境 7 | - jdk环境(不是jre) 8 | - 以上配置方法不做说明,自行谷歌 9 | - [发行版的镧·系统工具箱黑域一键补丁zip](https://github.com/xzr467706992/Lanthanum_system_toolbox_v2/releases) 10 | ### 过程 11 | - 完成原料步骤里的要求 12 | - 解压服务端zip到某个目录(最好不要包含中文,虽然似乎不影响) 13 | - 打开config 14 | - config中第一行中的port决定服务端口 15 | - 第二行的allow_multiuser决定是(true)否(false)允许多用户同时补丁【小心崩服】 16 | - 保存并关闭config 17 | - 点击start.bat开启 18 | - 客户端使用“切换服务器”来配置服务器信息 19 | - 尝试连接 20 | 21 | ## Bug 22 | - You tell me (Github issue) 23 | -------------------------------------------------------------------------------- /base_jars/apk/com/android/server/am/ActivityManagerService.smali: -------------------------------------------------------------------------------- 1 | .class public abstract Lcom/android/server/am/ActivityManagerService; 2 | .super Ljava/lang/Object; 3 | .source "ActivityManagerService.java" 4 | 5 | # interfaces 6 | .implements Landroid/os/IBinder; 7 | 8 | 9 | # instance fields 10 | .field mContext:Landroid/content/Context; 11 | 12 | 13 | # direct methods 14 | .method public constructor ()V 15 | .registers 1 16 | 17 | .prologue 18 | .line 19 19 | invoke-direct {p0}, Ljava/lang/Object;->()V 20 | 21 | return-void 22 | .end method 23 | 24 | .method private cleanUpRemovedTaskLocked(Lcom/android/server/am/TaskRecord;I)V 25 | .registers 6 26 | 27 | .prologue 28 | .line 132 29 | :try_start_0 30 | invoke-direct {p0, p1, p2}, Lcom/android/server/am/ActivityManagerService;->cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;I)V 31 | :try_end_3 32 | .catchall {:try_start_0 .. :try_end_3} :catchall_19 33 | 34 | .line 135 35 | and-int/lit8 v0, p2, 0x1 36 | 37 | if-eqz v0, :cond_15 38 | 39 | .line 136 40 | new-instance v1, Landroid/content/Intent; 41 | 42 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->intent:Landroid/content/Intent; 43 | 44 | if-eqz v0, :cond_16 45 | 46 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->intent:Landroid/content/Intent; 47 | 48 | :goto_f 49 | invoke-direct {v1, v0}, Landroid/content/Intent;->(Landroid/content/Intent;)V 50 | 51 | .line 137 52 | invoke-static {v1}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 53 | 54 | .line 140 55 | :cond_15 56 | return-void 57 | 58 | .line 136 59 | :cond_16 60 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->affinityIntent:Landroid/content/Intent; 61 | 62 | goto :goto_f 63 | 64 | .line 135 65 | :catchall_19 66 | move-exception v1 67 | 68 | and-int/lit8 v0, p2, 0x1 69 | 70 | if-eqz v0, :cond_2c 71 | 72 | .line 136 73 | new-instance v2, Landroid/content/Intent; 74 | 75 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->intent:Landroid/content/Intent; 76 | 77 | if-eqz v0, :cond_2d 78 | 79 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->intent:Landroid/content/Intent; 80 | 81 | :goto_26 82 | invoke-direct {v2, v0}, Landroid/content/Intent;->(Landroid/content/Intent;)V 83 | 84 | .line 137 85 | invoke-static {v2}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 86 | 87 | .line 138 88 | :cond_2c 89 | throw v1 90 | 91 | .line 136 92 | :cond_2d 93 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->affinityIntent:Landroid/content/Intent; 94 | 95 | goto :goto_26 96 | .end method 97 | 98 | .method private cleanUpRemovedTaskLocked(Lcom/android/server/am/TaskRecord;Z)V 99 | .registers 5 100 | 101 | .prologue 102 | .line 108 103 | :try_start_0 104 | invoke-direct {p0, p1, p2}, Lcom/android/server/am/ActivityManagerService;->cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;Z)V 105 | :try_end_3 106 | .catchall {:try_start_0 .. :try_end_3} :catchall_d 107 | 108 | .line 110 109 | if-eqz p2, :cond_c 110 | 111 | .line 111 112 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 113 | 114 | move-result-object v0 115 | 116 | invoke-static {v0}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 117 | 118 | .line 114 119 | :cond_c 120 | return-void 121 | 122 | .line 110 123 | :catchall_d 124 | move-exception v0 125 | 126 | if-eqz p2, :cond_17 127 | 128 | .line 111 129 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 130 | 131 | move-result-object v1 132 | 133 | invoke-static {v1}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 134 | 135 | :cond_17 136 | throw v0 137 | .end method 138 | 139 | .method private cleanUpRemovedTaskLocked(Lcom/android/server/am/TaskRecord;ZI)V 140 | .registers 6 141 | 142 | .prologue 143 | .line 120 144 | :try_start_0 145 | invoke-direct {p0, p1, p2, p3}, Lcom/android/server/am/ActivityManagerService;->cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;ZI)V 146 | :try_end_3 147 | .catchall {:try_start_0 .. :try_end_3} :catchall_d 148 | 149 | .line 122 150 | if-eqz p2, :cond_c 151 | 152 | .line 123 153 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 154 | 155 | move-result-object v0 156 | 157 | invoke-static {v0}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 158 | 159 | .line 126 160 | :cond_c 161 | return-void 162 | 163 | .line 122 164 | :catchall_d 165 | move-exception v0 166 | 167 | if-eqz p2, :cond_17 168 | 169 | .line 123 170 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 171 | 172 | move-result-object v1 173 | 174 | invoke-static {v1}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 175 | 176 | :cond_17 177 | throw v0 178 | .end method 179 | 180 | .method private cleanUpRemovedTaskLocked(Lcom/android/server/am/TaskRecord;ZZ)V 181 | .registers 6 182 | 183 | .prologue 184 | .line 96 185 | :try_start_0 186 | invoke-direct {p0, p1, p2, p3}, Lcom/android/server/am/ActivityManagerService;->cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;ZZ)V 187 | :try_end_3 188 | .catchall {:try_start_0 .. :try_end_3} :catchall_d 189 | 190 | .line 98 191 | if-eqz p2, :cond_c 192 | 193 | .line 99 194 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 195 | 196 | move-result-object v0 197 | 198 | invoke-static {v0}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 199 | 200 | .line 102 201 | :cond_c 202 | return-void 203 | 204 | .line 98 205 | :catchall_d 206 | move-exception v0 207 | 208 | if-eqz p2, :cond_17 209 | 210 | .line 99 211 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 212 | 213 | move-result-object v1 214 | 215 | invoke-static {v1}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 216 | 217 | :cond_17 218 | throw v0 219 | .end method 220 | 221 | .method private cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;I)V 222 | .registers 4 223 | 224 | .prologue 225 | .line 304 226 | new-instance v0, Ljava/lang/UnsupportedOperationException; 227 | 228 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 229 | 230 | throw v0 231 | .end method 232 | 233 | .method private cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;Z)V 234 | .registers 4 235 | 236 | .prologue 237 | .line 296 238 | new-instance v0, Ljava/lang/UnsupportedOperationException; 239 | 240 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 241 | 242 | throw v0 243 | .end method 244 | 245 | .method private cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;ZI)V 246 | .registers 5 247 | 248 | .prologue 249 | .line 300 250 | new-instance v0, Ljava/lang/UnsupportedOperationException; 251 | 252 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 253 | 254 | throw v0 255 | .end method 256 | 257 | .method private cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;ZZ)V 258 | .registers 5 259 | 260 | .prologue 261 | .line 292 262 | new-instance v0, Ljava/lang/UnsupportedOperationException; 263 | 264 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 265 | 266 | throw v0 267 | .end method 268 | 269 | .method private final handleAppDiedLocked(Lcom/android/server/am/ProcessRecord;ZZ)V 270 | .registers 5 271 | 272 | .prologue 273 | .line 85 274 | invoke-direct {p0, p1, p2, p3}, Lcom/android/server/am/ActivityManagerService;->handleAppDiedLocked$Pr(Lcom/android/server/am/ProcessRecord;ZZ)V 275 | 276 | .line 86 277 | if-nez p2, :cond_e 278 | 279 | if-eqz p3, :cond_e 280 | 281 | iget-boolean v0, p1, Lcom/android/server/am/ProcessRecord;->killedByAm:Z 282 | 283 | if-nez v0, :cond_e 284 | 285 | .line 87 286 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->onAppDied(Lcom/android/server/am/ProcessRecord;)V 287 | 288 | .line 89 289 | :cond_e 290 | return-void 291 | .end method 292 | 293 | .method private final handleAppDiedLocked$Pr(Lcom/android/server/am/ProcessRecord;ZZ)V 294 | .registers 5 295 | 296 | .prologue 297 | .line 287 298 | new-instance v0, Ljava/lang/UnsupportedOperationException; 299 | 300 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 301 | 302 | throw v0 303 | .end method 304 | 305 | 306 | # virtual methods 307 | .method public bindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;II)I 308 | .registers 9 309 | 310 | .prologue 311 | .line 203 312 | :try_start_0 313 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 314 | 315 | .line 204 316 | invoke-static {p1, p2, p3}, Lcom/android/server/am/PreventRunningUtils;->hookBindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;)Z 317 | 318 | move-result v0 319 | 320 | if-eqz v0, :cond_11 321 | 322 | .line 205 323 | invoke-virtual/range {p0 .. p7}, Lcom/android/server/am/ActivityManagerService;->bindService$Pr(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;II)I 324 | :try_end_c 325 | .catchall {:try_start_0 .. :try_end_c} :catchall_16 326 | 327 | move-result v0 328 | 329 | .line 211 330 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 331 | 332 | .line 208 333 | :goto_10 334 | return v0 335 | 336 | :cond_11 337 | const/4 v0, 0x0 338 | 339 | .line 211 340 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 341 | 342 | goto :goto_10 343 | 344 | :catchall_16 345 | move-exception v0 346 | 347 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 348 | 349 | throw v0 350 | .end method 351 | 352 | .method public bindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;ILjava/lang/String;I)I 353 | .registers 10 354 | 355 | .prologue 356 | .line 186 357 | :try_start_0 358 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 359 | 360 | .line 187 361 | invoke-static {p1, p2, p3}, Lcom/android/server/am/PreventRunningUtils;->hookBindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;)Z 362 | 363 | move-result v0 364 | 365 | if-eqz v0, :cond_11 366 | 367 | .line 188 368 | invoke-virtual/range {p0 .. p8}, Lcom/android/server/am/ActivityManagerService;->bindService$Pr(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;ILjava/lang/String;I)I 369 | :try_end_c 370 | .catchall {:try_start_0 .. :try_end_c} :catchall_16 371 | 372 | move-result v0 373 | 374 | .line 194 375 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 376 | 377 | .line 191 378 | :goto_10 379 | return v0 380 | 381 | :cond_11 382 | const/4 v0, 0x0 383 | 384 | .line 194 385 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 386 | 387 | goto :goto_10 388 | 389 | :catchall_16 390 | move-exception v0 391 | 392 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 393 | 394 | throw v0 395 | .end method 396 | 397 | .method public bindService$Pr(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;II)I 398 | .registers 9 399 | 400 | .prologue 401 | .line 331 402 | new-instance v0, Ljava/lang/UnsupportedOperationException; 403 | 404 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 405 | 406 | throw v0 407 | .end method 408 | 409 | .method public bindService$Pr(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;ILjava/lang/String;I)I 410 | .registers 10 411 | 412 | .prologue 413 | .line 325 414 | new-instance v0, Ljava/lang/UnsupportedOperationException; 415 | 416 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 417 | 418 | throw v0 419 | .end method 420 | 421 | .method public final broadcastIntent(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;Ljava/lang/String;IZZI)I 422 | .registers 14 423 | 424 | .prologue 425 | .line 243 426 | :try_start_0 427 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 428 | 429 | .line 244 430 | invoke-virtual/range {p0 .. p12}, Lcom/android/server/am/ActivityManagerService;->broadcastIntent$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;Ljava/lang/String;IZZI)I 431 | 432 | move-result v0 433 | 434 | .line 248 435 | if-nez v0, :cond_c 436 | 437 | .line 249 438 | invoke-static {p2}, Lcom/android/server/am/PreventRunningUtils;->onBroadcastIntent(Landroid/content/Intent;)V 439 | :try_end_c 440 | .catchall {:try_start_0 .. :try_end_c} :catchall_10 441 | 442 | .line 253 443 | :cond_c 444 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 445 | 446 | .line 251 447 | return v0 448 | 449 | .line 253 450 | :catchall_10 451 | move-exception v0 452 | 453 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 454 | 455 | throw v0 456 | .end method 457 | 458 | .method public final broadcastIntent(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;[Ljava/lang/String;ILandroid/os/Bundle;ZZI)I 459 | .registers 15 460 | 461 | .prologue 462 | .line 222 463 | :try_start_0 464 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 465 | 466 | .line 223 467 | invoke-virtual/range {p0 .. p13}, Lcom/android/server/am/ActivityManagerService;->broadcastIntent$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;[Ljava/lang/String;ILandroid/os/Bundle;ZZI)I 468 | 469 | move-result v0 470 | 471 | .line 228 472 | if-nez v0, :cond_c 473 | 474 | .line 229 475 | invoke-static {p2}, Lcom/android/server/am/PreventRunningUtils;->onBroadcastIntent(Landroid/content/Intent;)V 476 | :try_end_c 477 | .catchall {:try_start_0 .. :try_end_c} :catchall_10 478 | 479 | .line 233 480 | :cond_c 481 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 482 | 483 | .line 231 484 | return v0 485 | 486 | .line 233 487 | :catchall_10 488 | move-exception v0 489 | 490 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 491 | 492 | throw v0 493 | .end method 494 | 495 | .method public final broadcastIntent$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;Ljava/lang/String;IZZI)I 496 | .registers 14 497 | 498 | .prologue 499 | .line 346 500 | new-instance v0, Ljava/lang/UnsupportedOperationException; 501 | 502 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 503 | 504 | throw v0 505 | .end method 506 | 507 | .method public final broadcastIntent$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;[Ljava/lang/String;ILandroid/os/Bundle;ZZI)I 508 | .registers 15 509 | 510 | .prologue 511 | .line 339 512 | new-instance v0, Ljava/lang/UnsupportedOperationException; 513 | 514 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 515 | 516 | throw v0 517 | .end method 518 | 519 | .method getRecordForAppLocked(Landroid/app/IApplicationThread;)Lcom/android/server/am/ProcessRecord; 520 | .registers 3 521 | 522 | .prologue 523 | .line 24 524 | new-instance v0, Ljava/lang/UnsupportedOperationException; 525 | 526 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 527 | 528 | throw v0 529 | .end method 530 | 531 | .method public moveActivityTaskToBack(Landroid/os/IBinder;Z)Z 532 | .registers 4 533 | 534 | .prologue 535 | .line 144 536 | invoke-virtual {p0, p1, p2}, Lcom/android/server/am/ActivityManagerService;->moveActivityTaskToBack$Pr(Landroid/os/IBinder;Z)Z 537 | 538 | move-result v0 539 | 540 | if-eqz v0, :cond_b 541 | 542 | .line 145 543 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->onMoveActivityTaskToBack(Landroid/os/IBinder;)V 544 | 545 | .line 146 546 | const/4 v0, 0x1 547 | 548 | .line 148 549 | :goto_a 550 | return v0 551 | 552 | :cond_b 553 | const/4 v0, 0x0 554 | 555 | goto :goto_a 556 | .end method 557 | 558 | .method public moveActivityTaskToBack$Pr(Landroid/os/IBinder;Z)Z 559 | .registers 4 560 | 561 | .prologue 562 | .line 308 563 | new-instance v0, Ljava/lang/UnsupportedOperationException; 564 | 565 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 566 | 567 | throw v0 568 | .end method 569 | 570 | .method public final startActivity(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;)I 571 | .registers 12 572 | 573 | .prologue 574 | .line 61 575 | .line 62 576 | invoke-virtual/range {p0 .. p10}, Lcom/android/server/am/ActivityManagerService;->startActivity$Pr(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;)I 577 | 578 | move-result v0 579 | 580 | .line 61 581 | invoke-static {v0, p1, p2, p3}, Lcom/android/server/am/PreventRunningUtils;->onStartActivity(ILandroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;)I 582 | 583 | move-result v0 584 | 585 | return v0 586 | .end method 587 | 588 | .method public final startActivity(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILjava/lang/String;Landroid/os/ParcelFileDescriptor;Landroid/os/Bundle;)I 589 | .registers 13 590 | 591 | .prologue 592 | .line 73 593 | .line 74 594 | invoke-virtual/range {p0 .. p11}, Lcom/android/server/am/ActivityManagerService;->startActivity$Pr(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILjava/lang/String;Landroid/os/ParcelFileDescriptor;Landroid/os/Bundle;)I 595 | 596 | move-result v0 597 | 598 | .line 73 599 | invoke-static {v0, p1, p2, p3}, Lcom/android/server/am/PreventRunningUtils;->onStartActivity(ILandroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;)I 600 | 601 | move-result v0 602 | 603 | return v0 604 | .end method 605 | 606 | .method public final startActivity$Pr(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;)I 607 | .registers 12 608 | 609 | .prologue 610 | .line 274 611 | new-instance v0, Ljava/lang/UnsupportedOperationException; 612 | 613 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 614 | 615 | throw v0 616 | .end method 617 | 618 | .method public final startActivity$Pr(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILjava/lang/String;Landroid/os/ParcelFileDescriptor;Landroid/os/Bundle;)I 619 | .registers 13 620 | 621 | .prologue 622 | .line 282 623 | new-instance v0, Ljava/lang/UnsupportedOperationException; 624 | 625 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 626 | 627 | throw v0 628 | .end method 629 | 630 | 631 | .method final startProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;)Lcom/android/server/am/ProcessRecord; 632 | .registers 16 633 | 634 | .prologue 635 | .line 32 636 | invoke-static/range {p1 .. p6}, Lcom/android/server/am/PreventRunningUtils;->hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 637 | 638 | move-result v0 639 | 640 | if-eqz v0, :cond_b 641 | 642 | .line 33 643 | invoke-virtual/range {p0 .. p14}, Lcom/android/server/am/ActivityManagerService;->startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;)Lcom/android/server/am/ProcessRecord; 644 | 645 | move-result-object v0 646 | 647 | .line 38 648 | :goto_a 649 | return-object v0 650 | 651 | :cond_b 652 | const/4 v0, 0x0 653 | 654 | goto :goto_a 655 | .end method 656 | 657 | .method final startProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;Ljava/lang/String;)Lcom/android/server/am/ProcessRecord; 658 | .registers 18 659 | 660 | .prologue 661 | invoke-static/range {p1 .. p6}, Lcom/android/server/am/PreventRunningUtils;->hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 662 | 663 | move-result v0 664 | 665 | if-eqz v0, :cond_b 666 | 667 | invoke-virtual/range {p0 .. p15}, Lcom/android/server/am/ActivityManagerService;->startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;Ljava/lang/String;)Lcom/android/server/am/ProcessRecord; 668 | 669 | move-result-object v0 670 | 671 | :goto_a 672 | return-object v0 673 | 674 | :cond_b 675 | const/4 v0, 0x0 676 | 677 | goto :goto_a 678 | .end method 679 | 680 | .method final startProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZZ)Lcom/android/server/am/ProcessRecord; 681 | .registers 11 682 | 683 | .prologue 684 | 685 | invoke-static/range {p1 .. p6}, Lcom/android/server/am/PreventRunningUtils;->hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 686 | 687 | move-result v0 688 | 689 | if-eqz v0, :cond_b 690 | 691 | invoke-virtual/range {p0 .. p9}, Lcom/android/server/am/ActivityManagerService;->startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZ)Lcom/android/server/am/ProcessRecord; 692 | 693 | move-result-object v0 694 | 695 | :goto_a 696 | return-object v0 697 | 698 | :cond_b 699 | const/4 v0, 0x0 700 | 701 | goto :goto_a 702 | .end method 703 | 704 | .method final startProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZ)Lcom/android/server/am/ProcessRecord; 705 | .registers 11 706 | 707 | .prologue 708 | .line 47 709 | invoke-static/range {p1 .. p6}, Lcom/android/server/am/PreventRunningUtils;->hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 710 | 711 | move-result v0 712 | 713 | if-eqz v0, :cond_b 714 | 715 | .line 48 716 | invoke-virtual/range {p0 .. p9}, Lcom/android/server/am/ActivityManagerService;->startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZ)Lcom/android/server/am/ProcessRecord; 717 | 718 | move-result-object v0 719 | 720 | .line 53 721 | :goto_a 722 | return-object v0 723 | 724 | :cond_b 725 | const/4 v0, 0x0 726 | 727 | goto :goto_a 728 | .end method 729 | 730 | .method final startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;Ljava/lang/String;)Lcom/android/server/am/ProcessRecord; 731 | .registers 18 732 | 733 | .prologue 734 | 735 | new-instance v0, Ljava/lang/UnsupportedOperationException; 736 | 737 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 738 | 739 | throw v0 740 | .end method 741 | 742 | .method final startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;)Lcom/android/server/am/ProcessRecord; 743 | .registers 16 744 | 745 | .prologue 746 | .line 261 747 | new-instance v0, Ljava/lang/UnsupportedOperationException; 748 | 749 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 750 | 751 | throw v0 752 | .end method 753 | 754 | .method final startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZ)Lcom/android/server/am/ProcessRecord; 755 | .registers 11 756 | 757 | .prologue 758 | .line 268 759 | new-instance v0, Ljava/lang/UnsupportedOperationException; 760 | 761 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 762 | 763 | throw v0 764 | .end method 765 | 766 | .method final startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZZ)Lcom/android/server/am/ProcessRecord; 767 | .registers 11 768 | 769 | .prologue 770 | 771 | new-instance v0, Ljava/lang/UnsupportedOperationException; 772 | 773 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 774 | 775 | throw v0 776 | .end method 777 | 778 | .method public startService(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/ComponentName; 779 | .registers 6 780 | 781 | .prologue 782 | .line 171 783 | :try_start_0 784 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 785 | 786 | .line 172 787 | invoke-static {p1, p2}, Lcom/android/server/am/PreventRunningUtils;->hookStartService(Landroid/app/IApplicationThread;Landroid/content/Intent;)Z 788 | 789 | move-result v0 790 | 791 | if-eqz v0, :cond_11 792 | 793 | .line 173 794 | invoke-virtual {p0, p1, p2, p3, p4}, Lcom/android/server/am/ActivityManagerService;->startService$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/ComponentName; 795 | :try_end_c 796 | .catchall {:try_start_0 .. :try_end_c} :catchall_16 797 | 798 | move-result-object v0 799 | 800 | .line 177 801 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 802 | 803 | .line 175 804 | :goto_10 805 | return-object v0 806 | 807 | :cond_11 808 | const/4 v0, 0x0 809 | 810 | .line 177 811 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 812 | 813 | goto :goto_10 814 | 815 | :catchall_16 816 | move-exception v0 817 | 818 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 819 | 820 | throw v0 821 | .end method 822 | 823 | .method public startService(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;I)Landroid/content/ComponentName; 824 | .registers 7 825 | 826 | .prologue 827 | .line 157 828 | :try_start_0 829 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 830 | 831 | .line 158 832 | invoke-static {p1, p2}, Lcom/android/server/am/PreventRunningUtils;->hookStartService(Landroid/app/IApplicationThread;Landroid/content/Intent;)Z 833 | 834 | move-result v0 835 | 836 | if-eqz v0, :cond_11 837 | 838 | .line 159 839 | invoke-virtual/range {p0 .. p5}, Lcom/android/server/am/ActivityManagerService;->startService$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;I)Landroid/content/ComponentName; 840 | :try_end_c 841 | .catchall {:try_start_0 .. :try_end_c} :catchall_16 842 | 843 | move-result-object v0 844 | 845 | .line 163 846 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 847 | 848 | .line 161 849 | :goto_10 850 | return-object v0 851 | 852 | :cond_11 853 | const/4 v0, 0x0 854 | 855 | .line 163 856 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 857 | 858 | goto :goto_10 859 | 860 | :catchall_16 861 | move-exception v0 862 | 863 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 864 | 865 | throw v0 866 | .end method 867 | 868 | .method public startService$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/ComponentName; 869 | .registers 6 870 | 871 | .prologue 872 | .line 319 873 | new-instance v0, Ljava/lang/UnsupportedOperationException; 874 | 875 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 876 | 877 | throw v0 878 | .end method 879 | 880 | .method public startService$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;I)Landroid/content/ComponentName; 881 | .registers 7 882 | 883 | .prologue 884 | .line 314 885 | new-instance v0, Ljava/lang/UnsupportedOperationException; 886 | 887 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 888 | 889 | throw v0 890 | .end method 891 | -------------------------------------------------------------------------------- /base_jars/apk/com/android/server/am/PreventRunning.smali: -------------------------------------------------------------------------------- 1 | .class public Lcom/android/server/am/PreventRunning; 2 | .super Ljava/lang/Object; 3 | .source "PreventRunning.java" 4 | 5 | # interfaces 6 | .implements Lcom/android/server/am/PreventRunningHook; 7 | 8 | 9 | # static fields 10 | .field private static APKS:[Ljava/lang/String; = null 11 | 12 | .field private static final TAG:Ljava/lang/String; = "Prevent" 13 | 14 | .field public static final VERSION:I = 0x133a200 15 | 16 | 17 | # instance fields 18 | .field private mPreventRunning:Lcom/android/server/am/PreventRunningHook; 19 | 20 | 21 | # direct methods 22 | .method static constructor ()V 23 | .registers 3 24 | 25 | .prologue 26 | .line 26 27 | const/16 v0, 0x8 28 | 29 | new-array v0, v0, [Ljava/lang/String; 30 | 31 | const/4 v1, 0x0 32 | 33 | const-string v2, "/data/app/me.piebridge.prevent-1/base.apk" 34 | 35 | aput-object v2, v0, v1 36 | 37 | const/4 v1, 0x1 38 | 39 | const-string v2, "/data/app/me.piebridge.prevent-2/base.apk" 40 | 41 | aput-object v2, v0, v1 42 | 43 | const/4 v1, 0x2 44 | 45 | const-string v2, "/data/app/me.piebridge.prevent-3/base.apk" 46 | 47 | aput-object v2, v0, v1 48 | 49 | const/4 v1, 0x3 50 | 51 | const-string v2, "/data/app/me.piebridge.prevent-1.apk" 52 | 53 | aput-object v2, v0, v1 54 | 55 | const/4 v1, 0x4 56 | 57 | const-string v2, "/data/app/me.piebridge.prevent-2.apk" 58 | 59 | aput-object v2, v0, v1 60 | 61 | const/4 v1, 0x5 62 | 63 | const-string v2, "/data/app/me.piebridge.prevent-3.apk" 64 | 65 | aput-object v2, v0, v1 66 | 67 | const/4 v1, 0x6 68 | 69 | const-string v2, "/system/app/Prevent.apk" 70 | 71 | aput-object v2, v0, v1 72 | 73 | const/4 v1, 0x7 74 | 75 | const-string v2, "/system/priv-app/me.piebridge.prevent/me.piebridge.prevent.apk" 76 | 77 | aput-object v2, v0, v1 78 | 79 | sput-object v0, Lcom/android/server/am/PreventRunning;->APKS:[Ljava/lang/String; 80 | 81 | return-void 82 | .end method 83 | 84 | .method public constructor ()V 85 | .registers 6 86 | 87 | .prologue 88 | .line 37 89 | invoke-direct {p0}, Ljava/lang/Object;->()V 90 | 91 | .line 38 92 | sget-object v1, Lcom/android/server/am/PreventRunning;->APKS:[Ljava/lang/String; 93 | 94 | array-length v2, v1 95 | 96 | const/4 v0, 0x0 97 | 98 | :goto_7 99 | if-ge v0, v2, :cond_1c 100 | 101 | aget-object v3, v1, v0 102 | 103 | .line 39 104 | new-instance v4, Ljava/io/File; 105 | 106 | invoke-direct {v4, v3}, Ljava/io/File;->(Ljava/lang/String;)V 107 | 108 | .line 40 109 | invoke-virtual {v4}, Ljava/io/File;->exists()Z 110 | 111 | move-result v3 112 | 113 | if-eqz v3, :cond_1d 114 | 115 | invoke-direct {p0, v4}, Lcom/android/server/am/PreventRunning;->initPreventRunning(Ljava/io/File;)Z 116 | 117 | move-result v3 118 | 119 | if-eqz v3, :cond_1d 120 | 121 | .line 44 122 | :cond_1c 123 | return-void 124 | 125 | .line 38 126 | :cond_1d 127 | add-int/lit8 v0, v0, 0x1 128 | 129 | goto :goto_7 130 | .end method 131 | 132 | .method private initPreventRunning(Ljava/io/File;)Z 133 | .registers 7 134 | 135 | .prologue 136 | .line 48 137 | :try_start_0 138 | invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread; 139 | 140 | move-result-object v0 141 | 142 | invoke-virtual {v0}, Ljava/lang/Thread;->getContextClassLoader()Ljava/lang/ClassLoader; 143 | 144 | move-result-object v0 145 | 146 | .line 49 147 | new-instance v1, Ldalvik/system/DexClassLoader; 148 | 149 | invoke-virtual {p1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; 150 | 151 | move-result-object v2 152 | 153 | const-string v3, "/cache" 154 | 155 | const/4 v4, 0x0 156 | 157 | invoke-direct {v1, v2, v3, v4, v0}, Ldalvik/system/DexClassLoader;->(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V 158 | 159 | .line 50 160 | const-string v0, "Prevent" 161 | 162 | new-instance v2, Ljava/lang/StringBuilder; 163 | 164 | invoke-direct {v2}, Ljava/lang/StringBuilder;->()V 165 | 166 | const-string v3, "loading PreventRunning(20161024) from " 167 | 168 | invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 169 | 170 | move-result-object v2 171 | 172 | invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; 173 | 174 | move-result-object v2 175 | 176 | invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 177 | 178 | move-result-object v2 179 | 180 | invoke-static {v0, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I 181 | 182 | .line 51 183 | const-string v0, "me.piebridge.prevent.framework.PreventRunning" 184 | 185 | invoke-virtual {v1, v0}, Ljava/lang/ClassLoader;->loadClass(Ljava/lang/String;)Ljava/lang/Class; 186 | 187 | move-result-object v0 188 | 189 | invoke-virtual {v0}, Ljava/lang/Class;->newInstance()Ljava/lang/Object; 190 | 191 | move-result-object v0 192 | 193 | check-cast v0, Lcom/android/server/am/PreventRunningHook; 194 | 195 | iput-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 196 | 197 | .line 52 198 | const v0, 0x133a200 199 | 200 | invoke-virtual {p0, v0}, Lcom/android/server/am/PreventRunning;->setVersion(I)V 201 | 202 | .line 53 203 | const-string v0, "native" 204 | 205 | invoke-virtual {p0, v0}, Lcom/android/server/am/PreventRunning;->setMethod(Ljava/lang/String;)V 206 | :try_end_45 207 | .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_45} :catch_47 208 | .catch Ljava/lang/InstantiationException; {:try_start_0 .. :try_end_45} :catch_51 209 | .catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_45} :catch_5a 210 | .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_45} :catch_63 211 | 212 | .line 54 213 | const/4 v0, 0x1 214 | 215 | .line 64 216 | :goto_46 217 | return v0 218 | 219 | .line 55 220 | :catch_47 221 | move-exception v0 222 | 223 | .line 56 224 | const-string v1, "Prevent" 225 | 226 | const-string v2, "cannot find class" 227 | 228 | invoke-static {v1, v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I 229 | 230 | .line 64 231 | :goto_4f 232 | const/4 v0, 0x0 233 | 234 | goto :goto_46 235 | 236 | .line 57 237 | :catch_51 238 | move-exception v0 239 | 240 | .line 58 241 | const-string v1, "Prevent" 242 | 243 | const-string v2, "cannot instance class" 244 | 245 | invoke-static {v1, v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I 246 | 247 | goto :goto_4f 248 | 249 | .line 59 250 | :catch_5a 251 | move-exception v0 252 | 253 | .line 60 254 | const-string v1, "Prevent" 255 | 256 | const-string v2, "cannot access class" 257 | 258 | invoke-static {v1, v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I 259 | 260 | goto :goto_4f 261 | 262 | .line 61 263 | :catch_63 264 | move-exception v0 265 | 266 | .line 62 267 | const-string v1, "Prevent" 268 | 269 | new-instance v2, Ljava/lang/StringBuilder; 270 | 271 | invoke-direct {v2}, Ljava/lang/StringBuilder;->()V 272 | 273 | const-string v3, "cannot load PreventRunning from " 274 | 275 | invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 276 | 277 | move-result-object v2 278 | 279 | invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; 280 | 281 | move-result-object v2 282 | 283 | invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 284 | 285 | move-result-object v2 286 | 287 | invoke-static {v1, v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I 288 | 289 | goto :goto_4f 290 | .end method 291 | 292 | 293 | # virtual methods 294 | .method public hookBindService(Landroid/content/Intent;)Z 295 | .registers 3 296 | 297 | .prologue 298 | .line 172 299 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 300 | 301 | if-eqz v0, :cond_c 302 | 303 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 304 | 305 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->hookBindService(Landroid/content/Intent;)Z 306 | 307 | move-result v0 308 | 309 | if-eqz v0, :cond_e 310 | 311 | :cond_c 312 | const/4 v0, 0x1 313 | 314 | :goto_d 315 | return v0 316 | 317 | :cond_e 318 | const/4 v0, 0x0 319 | 320 | goto :goto_d 321 | .end method 322 | 323 | .method public hookStartProcessLocked(Landroid/content/Context;Landroid/content/pm/ApplicationInfo;Ljava/lang/String;Landroid/content/ComponentName;)Z 324 | .registers 6 325 | 326 | .prologue 327 | .line 144 328 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 329 | 330 | if-eqz v0, :cond_c 331 | 332 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 333 | 334 | invoke-interface {v0, p1, p2, p3, p4}, Lcom/android/server/am/PreventRunningHook;->hookStartProcessLocked(Landroid/content/Context;Landroid/content/pm/ApplicationInfo;Ljava/lang/String;Landroid/content/ComponentName;)Z 335 | 336 | move-result v0 337 | 338 | if-eqz v0, :cond_e 339 | 340 | :cond_c 341 | const/4 v0, 0x1 342 | 343 | :goto_d 344 | return v0 345 | 346 | :cond_e 347 | const/4 v0, 0x0 348 | 349 | goto :goto_d 350 | .end method 351 | 352 | .method public hookStartService(Landroid/content/Intent;)Z 353 | .registers 3 354 | 355 | .prologue 356 | .line 177 357 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 358 | 359 | if-eqz v0, :cond_c 360 | 361 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 362 | 363 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->hookStartService(Landroid/content/Intent;)Z 364 | 365 | move-result v0 366 | 367 | if-eqz v0, :cond_e 368 | 369 | :cond_c 370 | const/4 v0, 0x1 371 | 372 | :goto_d 373 | return v0 374 | 375 | :cond_e 376 | const/4 v0, 0x0 377 | 378 | goto :goto_d 379 | .end method 380 | 381 | .method public isActiviated()Z 382 | .registers 2 383 | 384 | .prologue 385 | .line 181 386 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 387 | 388 | if-eqz v0, :cond_6 389 | 390 | const/4 v0, 0x1 391 | 392 | :goto_5 393 | return v0 394 | 395 | :cond_6 396 | const/4 v0, 0x0 397 | 398 | goto :goto_5 399 | .end method 400 | 401 | .method public isExcludingStopped(Ljava/lang/String;)Z 402 | .registers 3 403 | 404 | .prologue 405 | .line 139 406 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 407 | 408 | if-eqz v0, :cond_c 409 | 410 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 411 | 412 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->isExcludingStopped(Ljava/lang/String;)Z 413 | 414 | move-result v0 415 | 416 | if-eqz v0, :cond_e 417 | 418 | :cond_c 419 | const/4 v0, 0x1 420 | 421 | :goto_d 422 | return v0 423 | 424 | :cond_e 425 | const/4 v0, 0x0 426 | 427 | goto :goto_d 428 | .end method 429 | 430 | .method public match(ILjava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;)I 431 | .registers 16 432 | .annotation system Ldalvik/annotation/Signature; 433 | value = { 434 | "(I", 435 | "Ljava/lang/Object;", 436 | "Ljava/lang/String;", 437 | "Ljava/lang/String;", 438 | "Ljava/lang/String;", 439 | "Landroid/net/Uri;", 440 | "Ljava/util/Set", 441 | "<", 442 | "Ljava/lang/String;", 443 | ">;)I" 444 | } 445 | .end annotation 446 | 447 | .prologue 448 | .line 149 449 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 450 | 451 | if-eqz v0, :cond_11 452 | 453 | .line 150 454 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 455 | 456 | move v1, p1 457 | 458 | move-object v2, p2 459 | 460 | move-object v3, p3 461 | 462 | move-object v4, p4 463 | 464 | move-object v5, p5 465 | 466 | move-object v6, p6 467 | 468 | move-object v7, p7 469 | 470 | invoke-interface/range {v0 .. v7}, Lcom/android/server/am/PreventRunningHook;->match(ILjava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;)I 471 | 472 | move-result p1 473 | 474 | .line 152 475 | :cond_11 476 | return p1 477 | .end method 478 | 479 | .method public onAppDied(Ljava/lang/Object;)V 480 | .registers 3 481 | 482 | .prologue 483 | .line 104 484 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 485 | 486 | if-eqz v0, :cond_9 487 | 488 | .line 105 489 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 490 | 491 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onAppDied(Ljava/lang/Object;)V 492 | 493 | .line 107 494 | :cond_9 495 | return-void 496 | .end method 497 | 498 | .method public onBroadcastIntent(Landroid/content/Intent;)V 499 | .registers 3 500 | 501 | .prologue 502 | .line 76 503 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 504 | 505 | if-eqz v0, :cond_9 506 | 507 | .line 77 508 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 509 | 510 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onBroadcastIntent(Landroid/content/Intent;)V 511 | 512 | .line 79 513 | :cond_9 514 | return-void 515 | .end method 516 | 517 | .method public onCleanUpRemovedTask(Ljava/lang/String;)V 518 | .registers 3 519 | 520 | .prologue 521 | .line 83 522 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 523 | 524 | if-eqz v0, :cond_9 525 | 526 | .line 84 527 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 528 | 529 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onCleanUpRemovedTask(Ljava/lang/String;)V 530 | 531 | .line 86 532 | :cond_9 533 | return-void 534 | .end method 535 | 536 | .method public onDestroyActivity(Ljava/lang/Object;)V 537 | .registers 3 538 | 539 | .prologue 540 | .line 132 541 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 542 | 543 | if-eqz v0, :cond_9 544 | 545 | .line 133 546 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 547 | 548 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onDestroyActivity(Ljava/lang/Object;)V 549 | 550 | .line 135 551 | :cond_9 552 | return-void 553 | .end method 554 | 555 | .method public onLaunchActivity(Ljava/lang/Object;)V 556 | .registers 3 557 | 558 | .prologue 559 | .line 111 560 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 561 | 562 | if-eqz v0, :cond_9 563 | 564 | .line 112 565 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 566 | 567 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onLaunchActivity(Ljava/lang/Object;)V 568 | 569 | .line 114 570 | :cond_9 571 | return-void 572 | .end method 573 | 574 | .method public onMoveActivityTaskToBack(Ljava/lang/String;)V 575 | .registers 3 576 | 577 | .prologue 578 | .line 97 579 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 580 | 581 | if-eqz v0, :cond_9 582 | 583 | .line 98 584 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 585 | 586 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onMoveActivityTaskToBack(Ljava/lang/String;)V 587 | 588 | .line 100 589 | :cond_9 590 | return-void 591 | .end method 592 | 593 | .method public onResumeActivity(Ljava/lang/Object;)V 594 | .registers 3 595 | 596 | .prologue 597 | .line 118 598 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 599 | 600 | if-eqz v0, :cond_9 601 | 602 | .line 119 603 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 604 | 605 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onResumeActivity(Ljava/lang/Object;)V 606 | 607 | .line 121 608 | :cond_9 609 | return-void 610 | .end method 611 | 612 | .method public onStartHomeActivity(Ljava/lang/String;)V 613 | .registers 3 614 | 615 | .prologue 616 | .line 90 617 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 618 | 619 | if-eqz v0, :cond_9 620 | 621 | .line 91 622 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 623 | 624 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onStartHomeActivity(Ljava/lang/String;)V 625 | 626 | .line 93 627 | :cond_9 628 | return-void 629 | .end method 630 | 631 | .method public onUserLeavingActivity(Ljava/lang/Object;)V 632 | .registers 3 633 | 634 | .prologue 635 | .line 125 636 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 637 | 638 | if-eqz v0, :cond_9 639 | 640 | .line 126 641 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 642 | 643 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onUserLeavingActivity(Ljava/lang/Object;)V 644 | 645 | .line 128 646 | :cond_9 647 | return-void 648 | .end method 649 | 650 | .method public setMethod(Ljava/lang/String;)V 651 | .registers 3 652 | 653 | .prologue 654 | .line 165 655 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 656 | 657 | if-eqz v0, :cond_9 658 | 659 | .line 166 660 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 661 | 662 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->setMethod(Ljava/lang/String;)V 663 | 664 | .line 168 665 | :cond_9 666 | return-void 667 | .end method 668 | 669 | .method public setSender(Ljava/lang/String;)V 670 | .registers 3 671 | 672 | .prologue 673 | .line 69 674 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 675 | 676 | if-eqz v0, :cond_9 677 | 678 | .line 70 679 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 680 | 681 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->setSender(Ljava/lang/String;)V 682 | 683 | .line 72 684 | :cond_9 685 | return-void 686 | .end method 687 | 688 | .method public setVersion(I)V 689 | .registers 3 690 | 691 | .prologue 692 | .line 158 693 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 694 | 695 | if-eqz v0, :cond_9 696 | 697 | .line 159 698 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 699 | 700 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->setVersion(I)V 701 | 702 | .line 161 703 | :cond_9 704 | return-void 705 | .end method 706 | -------------------------------------------------------------------------------- /base_jars/apk/com/android/server/am/PreventRunningHook.smali: -------------------------------------------------------------------------------- 1 | .class public interface abstract Lcom/android/server/am/PreventRunningHook; 2 | .super Ljava/lang/Object; 3 | .source "PreventRunningHook.java" 4 | 5 | 6 | # virtual methods 7 | .method public abstract hookBindService(Landroid/content/Intent;)Z 8 | .end method 9 | 10 | .method public abstract hookStartProcessLocked(Landroid/content/Context;Landroid/content/pm/ApplicationInfo;Ljava/lang/String;Landroid/content/ComponentName;)Z 11 | .end method 12 | 13 | .method public abstract hookStartService(Landroid/content/Intent;)Z 14 | .end method 15 | 16 | .method public abstract isExcludingStopped(Ljava/lang/String;)Z 17 | .end method 18 | 19 | .method public abstract match(ILjava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;)I 20 | .annotation system Ldalvik/annotation/Signature; 21 | value = { 22 | "(I", 23 | "Ljava/lang/Object;", 24 | "Ljava/lang/String;", 25 | "Ljava/lang/String;", 26 | "Ljava/lang/String;", 27 | "Landroid/net/Uri;", 28 | "Ljava/util/Set", 29 | "<", 30 | "Ljava/lang/String;", 31 | ">;)I" 32 | } 33 | .end annotation 34 | .end method 35 | 36 | .method public abstract onAppDied(Ljava/lang/Object;)V 37 | .end method 38 | 39 | .method public abstract onBroadcastIntent(Landroid/content/Intent;)V 40 | .end method 41 | 42 | .method public abstract onCleanUpRemovedTask(Ljava/lang/String;)V 43 | .end method 44 | 45 | .method public abstract onDestroyActivity(Ljava/lang/Object;)V 46 | .end method 47 | 48 | .method public abstract onLaunchActivity(Ljava/lang/Object;)V 49 | .end method 50 | 51 | .method public abstract onMoveActivityTaskToBack(Ljava/lang/String;)V 52 | .end method 53 | 54 | .method public abstract onResumeActivity(Ljava/lang/Object;)V 55 | .end method 56 | 57 | .method public abstract onStartHomeActivity(Ljava/lang/String;)V 58 | .end method 59 | 60 | .method public abstract onUserLeavingActivity(Ljava/lang/Object;)V 61 | .end method 62 | 63 | .method public abstract setMethod(Ljava/lang/String;)V 64 | .end method 65 | 66 | .method public abstract setSender(Ljava/lang/String;)V 67 | .end method 68 | 69 | .method public abstract setVersion(I)V 70 | .end method 71 | -------------------------------------------------------------------------------- /base_jars/apk/com/android/server/am/PreventRunningUtils.smali: -------------------------------------------------------------------------------- 1 | .class public Lcom/android/server/am/PreventRunningUtils; 2 | .super Ljava/lang/Object; 3 | .source "PreventRunningUtils.java" 4 | 5 | 6 | # static fields 7 | .field private static ams:Lcom/android/server/am/ActivityManagerService; 8 | 9 | .field private static mPreventRunning:Lcom/android/server/am/PreventRunning; 10 | 11 | 12 | # direct methods 13 | .method static constructor ()V 14 | .registers 1 15 | 16 | .prologue 17 | .line 21 18 | new-instance v0, Lcom/android/server/am/PreventRunning; 19 | 20 | invoke-direct {v0}, Lcom/android/server/am/PreventRunning;->()V 21 | 22 | sput-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 23 | 24 | return-void 25 | .end method 26 | 27 | .method private constructor ()V 28 | .registers 1 29 | 30 | .prologue 31 | .line 23 32 | invoke-direct {p0}, Ljava/lang/Object;->()V 33 | 34 | .line 24 35 | return-void 36 | .end method 37 | 38 | .method public static clearSender()V 39 | .registers 2 40 | 41 | .prologue 42 | .line 91 43 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 44 | 45 | const/4 v1, 0x0 46 | 47 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->setSender(Ljava/lang/String;)V 48 | 49 | .line 92 50 | return-void 51 | .end method 52 | 53 | .method private static forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 54 | .registers 3 55 | 56 | .prologue 57 | .line 126 58 | sget v0, Landroid/os/Build$VERSION;->SDK_INT:I 59 | 60 | const/16 v1, 0x17 61 | 62 | if-lt v0, v1, :cond_b 63 | 64 | .line 127 65 | invoke-static {p0}, Lcom/android/server/am/ActivityRecord;->forTokenLocked(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 66 | 67 | move-result-object v0 68 | 69 | .line 129 70 | :goto_a 71 | return-object v0 72 | 73 | :cond_b 74 | invoke-static {p0}, Lcom/android/server/am/ActivityRecord;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 75 | 76 | move-result-object v0 77 | 78 | goto :goto_a 79 | .end method 80 | 81 | .method private static getAms()Lcom/android/server/am/ActivityManagerService; 82 | .registers 1 83 | 84 | .prologue 85 | .line 27 86 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->ams:Lcom/android/server/am/ActivityManagerService; 87 | 88 | if-nez v0, :cond_e 89 | 90 | .line 28 91 | const-string v0, "activity" 92 | 93 | invoke-static {v0}, Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder; 94 | 95 | move-result-object v0 96 | 97 | check-cast v0, Lcom/android/server/am/ActivityManagerService; 98 | 99 | sput-object v0, Lcom/android/server/am/PreventRunningUtils;->ams:Lcom/android/server/am/ActivityManagerService; 100 | 101 | .line 30 102 | :cond_e 103 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->ams:Lcom/android/server/am/ActivityManagerService; 104 | 105 | return-object v0 106 | .end method 107 | 108 | .method public static hookBindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;)Z 109 | .registers 4 110 | 111 | .prologue 112 | .line 99 113 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 114 | 115 | invoke-virtual {v0, p2}, Lcom/android/server/am/PreventRunning;->hookBindService(Landroid/content/Intent;)Z 116 | 117 | move-result v0 118 | 119 | return v0 120 | .end method 121 | 122 | .method public static hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 123 | .registers 8 124 | 125 | .prologue 126 | .line 49 127 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 128 | 129 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->getAms()Lcom/android/server/am/ActivityManagerService; 130 | 131 | move-result-object v1 132 | 133 | iget-object v1, v1, Lcom/android/server/am/ActivityManagerService;->mContext:Landroid/content/Context; 134 | 135 | invoke-virtual {v0, v1, p1, p4, p5}, Lcom/android/server/am/PreventRunning;->hookStartProcessLocked(Landroid/content/Context;Landroid/content/pm/ApplicationInfo;Ljava/lang/String;Landroid/content/ComponentName;)Z 136 | 137 | move-result v0 138 | 139 | return v0 140 | .end method 141 | 142 | .method public static hookStartService(Landroid/app/IApplicationThread;Landroid/content/Intent;)Z 143 | .registers 3 144 | 145 | .prologue 146 | .line 95 147 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 148 | 149 | invoke-virtual {v0, p1}, Lcom/android/server/am/PreventRunning;->hookStartService(Landroid/content/Intent;)Z 150 | 151 | move-result v0 152 | 153 | return v0 154 | .end method 155 | 156 | .method public static isExcludingStopped(Landroid/content/Intent;)Z 157 | .registers 4 158 | 159 | .prologue 160 | .line 34 161 | invoke-virtual {p0}, Landroid/content/Intent;->getAction()Ljava/lang/String; 162 | 163 | move-result-object v0 164 | 165 | .line 35 166 | invoke-virtual {p0}, Landroid/content/Intent;->getFlags()I 167 | 168 | move-result v1 169 | 170 | and-int/lit8 v1, v1, 0x30 171 | 172 | const/16 v2, 0x10 173 | 174 | if-ne v1, v2, :cond_1a 175 | 176 | if-eqz v0, :cond_1a 177 | 178 | sget-object v1, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 179 | 180 | .line 36 181 | invoke-virtual {v1, v0}, Lcom/android/server/am/PreventRunning;->isExcludingStopped(Ljava/lang/String;)Z 182 | 183 | move-result v0 184 | 185 | if-eqz v0, :cond_1a 186 | 187 | const/4 v0, 0x1 188 | 189 | .line 35 190 | :goto_19 191 | return v0 192 | 193 | .line 36 194 | :cond_1a 195 | const/4 v0, 0x0 196 | 197 | goto :goto_19 198 | .end method 199 | 200 | .method public static match(Landroid/content/IntentFilter;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;Ljava/lang/String;)I 201 | .registers 15 202 | .annotation system Ldalvik/annotation/Signature; 203 | value = { 204 | "(", 205 | "Landroid/content/IntentFilter;", 206 | "Ljava/lang/String;", 207 | "Ljava/lang/String;", 208 | "Ljava/lang/String;", 209 | "Landroid/net/Uri;", 210 | "Ljava/util/Set", 211 | "<", 212 | "Ljava/lang/String;", 213 | ">;", 214 | "Ljava/lang/String;", 215 | ")I" 216 | } 217 | .end annotation 218 | 219 | .prologue 220 | .line 40 221 | invoke-virtual/range {p0 .. p6}, Landroid/content/IntentFilter;->match(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;Ljava/lang/String;)I 222 | 223 | move-result v1 224 | 225 | .line 41 226 | if-ltz v1, :cond_12 227 | 228 | .line 42 229 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 230 | 231 | move-object v2, p0 232 | 233 | move-object v3, p1 234 | 235 | move-object v4, p2 236 | 237 | move-object v5, p3 238 | 239 | move-object v6, p4 240 | 241 | move-object v7, p5 242 | 243 | invoke-virtual/range {v0 .. v7}, Lcom/android/server/am/PreventRunning;->match(ILjava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;)I 244 | 245 | move-result v1 246 | 247 | .line 44 248 | :cond_12 249 | return v1 250 | .end method 251 | 252 | .method public static onAppDied(Lcom/android/server/am/ProcessRecord;)V 253 | .registers 2 254 | 255 | .prologue 256 | .line 63 257 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 258 | 259 | invoke-virtual {v0, p0}, Lcom/android/server/am/PreventRunning;->onAppDied(Ljava/lang/Object;)V 260 | 261 | .line 64 262 | return-void 263 | .end method 264 | 265 | .method public static onBroadcastIntent(Landroid/content/Intent;)V 266 | .registers 2 267 | 268 | .prologue 269 | .line 103 270 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 271 | 272 | invoke-virtual {v0, p0}, Lcom/android/server/am/PreventRunning;->onBroadcastIntent(Landroid/content/Intent;)V 273 | 274 | .line 104 275 | return-void 276 | .end method 277 | 278 | .method public static onCleanUpRemovedTask(Landroid/content/Intent;)V 279 | .registers 3 280 | 281 | .prologue 282 | .line 75 283 | if-eqz p0, :cond_15 284 | 285 | invoke-virtual {p0}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName; 286 | 287 | move-result-object v0 288 | 289 | if-eqz v0, :cond_15 290 | 291 | .line 76 292 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 293 | 294 | invoke-virtual {p0}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName; 295 | 296 | move-result-object v1 297 | 298 | invoke-virtual {v1}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String; 299 | 300 | move-result-object v1 301 | 302 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onCleanUpRemovedTask(Ljava/lang/String;)V 303 | 304 | .line 78 305 | :cond_15 306 | return-void 307 | .end method 308 | 309 | .method public static onDestroyActivity(Landroid/os/IBinder;)V 310 | .registers 3 311 | 312 | .prologue 313 | .line 117 314 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 315 | 316 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 317 | 318 | move-result-object v1 319 | 320 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onDestroyActivity(Ljava/lang/Object;)V 321 | 322 | .line 118 323 | return-void 324 | .end method 325 | 326 | .method public static onLaunchActivity(Landroid/os/IBinder;)V 327 | .registers 3 328 | 329 | .prologue 330 | .line 121 331 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 332 | 333 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 334 | 335 | move-result-object v1 336 | 337 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onLaunchActivity(Ljava/lang/Object;)V 338 | 339 | .line 122 340 | return-void 341 | .end method 342 | 343 | .method public static onMoveActivityTaskToBack(Landroid/os/IBinder;)V 344 | .registers 3 345 | 346 | .prologue 347 | .line 81 348 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 349 | 350 | move-result-object v0 351 | 352 | .line 82 353 | sget-object v1, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 354 | 355 | if-eqz v0, :cond_e 356 | 357 | iget-object v0, v0, Lcom/android/server/am/ActivityRecord;->packageName:Ljava/lang/String; 358 | 359 | :goto_a 360 | invoke-virtual {v1, v0}, Lcom/android/server/am/PreventRunning;->onMoveActivityTaskToBack(Ljava/lang/String;)V 361 | 362 | .line 83 363 | return-void 364 | 365 | .line 82 366 | :cond_e 367 | const/4 v0, 0x0 368 | 369 | goto :goto_a 370 | .end method 371 | 372 | .method public static onResumeActivity(Landroid/os/IBinder;)V 373 | .registers 3 374 | 375 | .prologue 376 | .line 113 377 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 378 | 379 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 380 | 381 | move-result-object v1 382 | 383 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onResumeActivity(Ljava/lang/Object;)V 384 | 385 | .line 114 386 | return-void 387 | .end method 388 | 389 | .method public static onStartActivity(ILandroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;)I 390 | .registers 6 391 | 392 | .prologue 393 | .line 53 394 | if-ltz p0, :cond_27 395 | 396 | if-eqz p3, :cond_27 397 | 398 | const-string v0, "android.intent.category.HOME" 399 | 400 | invoke-virtual {p3, v0}, Landroid/content/Intent;->hasCategory(Ljava/lang/String;)Z 401 | 402 | move-result v0 403 | 404 | if-nez v0, :cond_14 405 | 406 | const-string v0, "android.intent.category.LAUNCHER" 407 | 408 | invoke-virtual {p3, v0}, Landroid/content/Intent;->hasCategory(Ljava/lang/String;)Z 409 | 410 | move-result v0 411 | 412 | if-eqz v0, :cond_27 413 | 414 | .line 54 415 | :cond_14 416 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->getAms()Lcom/android/server/am/ActivityManagerService; 417 | 418 | move-result-object v0 419 | 420 | invoke-virtual {v0, p1}, Lcom/android/server/am/ActivityManagerService;->getRecordForAppLocked(Landroid/app/IApplicationThread;)Lcom/android/server/am/ProcessRecord; 421 | 422 | move-result-object v0 423 | 424 | .line 55 425 | if-eqz v0, :cond_27 426 | 427 | .line 56 428 | sget-object v1, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 429 | 430 | iget-object v0, v0, Lcom/android/server/am/ProcessRecord;->info:Landroid/content/pm/ApplicationInfo; 431 | 432 | iget-object v0, v0, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String; 433 | 434 | invoke-virtual {v1, v0}, Lcom/android/server/am/PreventRunning;->onStartHomeActivity(Ljava/lang/String;)V 435 | 436 | .line 59 437 | :cond_27 438 | return p0 439 | .end method 440 | 441 | .method public static onUserLeavingActivity(Landroid/os/IBinder;ZZ)V 442 | .registers 5 443 | 444 | .prologue 445 | .line 107 446 | if-eqz p2, :cond_b 447 | 448 | .line 108 449 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 450 | 451 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 452 | 453 | move-result-object v1 454 | 455 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onUserLeavingActivity(Ljava/lang/Object;)V 456 | 457 | .line 110 458 | :cond_b 459 | return-void 460 | .end method 461 | 462 | .method public static returnFalse()Z 463 | .registers 1 464 | 465 | .prologue 466 | .line 67 467 | const/4 v0, 0x0 468 | 469 | return v0 470 | .end method 471 | 472 | .method public static returnFalse(Z)Z 473 | .registers 2 474 | 475 | .prologue 476 | .line 71 477 | if-eqz p0, :cond_c 478 | 479 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 480 | 481 | invoke-virtual {v0}, Lcom/android/server/am/PreventRunning;->isActiviated()Z 482 | 483 | move-result v0 484 | 485 | if-nez v0, :cond_c 486 | 487 | const/4 v0, 0x1 488 | 489 | :goto_b 490 | return v0 491 | 492 | :cond_c 493 | const/4 v0, 0x0 494 | 495 | goto :goto_b 496 | .end method 497 | 498 | .method public static setSender(Landroid/app/IApplicationThread;)V 499 | .registers 3 500 | 501 | .prologue 502 | .line 86 503 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->getAms()Lcom/android/server/am/ActivityManagerService; 504 | 505 | move-result-object v0 506 | 507 | invoke-virtual {v0, p0}, Lcom/android/server/am/ActivityManagerService;->getRecordForAppLocked(Landroid/app/IApplicationThread;)Lcom/android/server/am/ProcessRecord; 508 | 509 | move-result-object v0 510 | 511 | .line 87 512 | sget-object v1, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 513 | 514 | if-eqz v0, :cond_14 515 | 516 | iget-object v0, v0, Lcom/android/server/am/ProcessRecord;->info:Landroid/content/pm/ApplicationInfo; 517 | 518 | iget-object v0, v0, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String; 519 | 520 | :goto_10 521 | invoke-virtual {v1, v0}, Lcom/android/server/am/PreventRunning;->setSender(Ljava/lang/String;)V 522 | 523 | .line 88 524 | return-void 525 | 526 | .line 87 527 | :cond_14 528 | invoke-static {}, Landroid/os/Binder;->getCallingUid()I 529 | 530 | move-result v0 531 | 532 | invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String; 533 | 534 | move-result-object v0 535 | 536 | goto :goto_10 537 | .end method 538 | -------------------------------------------------------------------------------- /base_jars/apk_oreo/com/android/server/am/ActivityManagerService.smali: -------------------------------------------------------------------------------- 1 | .class public abstract Lcom/android/server/am/ActivityManagerService; 2 | .super Ljava/lang/Object; 3 | .source "ActivityManagerService.java" 4 | 5 | # interfaces 6 | .implements Landroid/os/IBinder; 7 | 8 | 9 | # instance fields 10 | .field mContext:Landroid/content/Context; 11 | 12 | 13 | # direct methods 14 | .method public constructor ()V 15 | .registers 1 16 | 17 | invoke-direct {p0}, Ljava/lang/Object;->()V 18 | 19 | return-void 20 | .end method 21 | 22 | .method private cleanUpRemovedTaskLocked(Lcom/android/server/am/TaskRecord;I)V 23 | .registers 6 24 | 25 | :try_start_0 26 | invoke-direct {p0, p1, p2}, Lcom/android/server/am/ActivityManagerService;->cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;I)V 27 | :try_end_3 28 | .catchall {:try_start_0 .. :try_end_3} :catchall_19 29 | 30 | and-int/lit8 v0, p2, 0x1 31 | 32 | if-eqz v0, :cond_15 33 | 34 | new-instance v1, Landroid/content/Intent; 35 | 36 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->intent:Landroid/content/Intent; 37 | 38 | if-eqz v0, :cond_16 39 | 40 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->intent:Landroid/content/Intent; 41 | 42 | :goto_f 43 | invoke-direct {v1, v0}, Landroid/content/Intent;->(Landroid/content/Intent;)V 44 | 45 | invoke-static {v1}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 46 | 47 | :cond_15 48 | return-void 49 | 50 | :cond_16 51 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->affinityIntent:Landroid/content/Intent; 52 | 53 | goto :goto_f 54 | 55 | :catchall_19 56 | move-exception v1 57 | 58 | and-int/lit8 v0, p2, 0x1 59 | 60 | if-eqz v0, :cond_2c 61 | 62 | new-instance v2, Landroid/content/Intent; 63 | 64 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->intent:Landroid/content/Intent; 65 | 66 | if-eqz v0, :cond_2d 67 | 68 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->intent:Landroid/content/Intent; 69 | 70 | :goto_26 71 | invoke-direct {v2, v0}, Landroid/content/Intent;->(Landroid/content/Intent;)V 72 | 73 | invoke-static {v2}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 74 | 75 | :cond_2c 76 | throw v1 77 | 78 | :cond_2d 79 | iget-object v0, p1, Lcom/android/server/am/TaskRecord;->affinityIntent:Landroid/content/Intent; 80 | 81 | goto :goto_26 82 | .end method 83 | 84 | .method private cleanUpRemovedTaskLocked(Lcom/android/server/am/TaskRecord;Z)V 85 | .registers 5 86 | 87 | :try_start_0 88 | invoke-direct {p0, p1, p2}, Lcom/android/server/am/ActivityManagerService;->cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;Z)V 89 | :try_end_3 90 | .catchall {:try_start_0 .. :try_end_3} :catchall_d 91 | 92 | if-eqz p2, :cond_c 93 | 94 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 95 | 96 | move-result-object v0 97 | 98 | invoke-static {v0}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 99 | 100 | :cond_c 101 | return-void 102 | 103 | :catchall_d 104 | move-exception v0 105 | 106 | if-eqz p2, :cond_17 107 | 108 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 109 | 110 | move-result-object v1 111 | 112 | invoke-static {v1}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 113 | 114 | :cond_17 115 | throw v0 116 | .end method 117 | 118 | .method private cleanUpRemovedTaskLocked(Lcom/android/server/am/TaskRecord;ZI)V 119 | .registers 6 120 | 121 | :try_start_0 122 | invoke-direct {p0, p1, p2, p3}, Lcom/android/server/am/ActivityManagerService;->cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;ZI)V 123 | :try_end_3 124 | .catchall {:try_start_0 .. :try_end_3} :catchall_d 125 | 126 | if-eqz p2, :cond_c 127 | 128 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 129 | 130 | move-result-object v0 131 | 132 | invoke-static {v0}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 133 | 134 | :cond_c 135 | return-void 136 | 137 | :catchall_d 138 | move-exception v0 139 | 140 | if-eqz p2, :cond_17 141 | 142 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 143 | 144 | move-result-object v1 145 | 146 | invoke-static {v1}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 147 | 148 | :cond_17 149 | throw v0 150 | .end method 151 | 152 | .method private cleanUpRemovedTaskLocked(Lcom/android/server/am/TaskRecord;ZZ)V 153 | .registers 6 154 | 155 | :try_start_0 156 | invoke-direct {p0, p1, p2, p3}, Lcom/android/server/am/ActivityManagerService;->cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;ZZ)V 157 | :try_end_3 158 | .catchall {:try_start_0 .. :try_end_3} :catchall_d 159 | 160 | if-eqz p2, :cond_c 161 | 162 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 163 | 164 | move-result-object v0 165 | 166 | invoke-static {v0}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 167 | 168 | :cond_c 169 | return-void 170 | 171 | :catchall_d 172 | move-exception v0 173 | 174 | if-eqz p2, :cond_17 175 | 176 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 177 | 178 | move-result-object v1 179 | 180 | invoke-static {v1}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 181 | 182 | :cond_17 183 | throw v0 184 | .end method 185 | 186 | .method private cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;I)V 187 | .registers 4 188 | 189 | new-instance v0, Ljava/lang/UnsupportedOperationException; 190 | 191 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 192 | 193 | throw v0 194 | .end method 195 | 196 | .method private cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;Z)V 197 | .registers 4 198 | 199 | new-instance v0, Ljava/lang/UnsupportedOperationException; 200 | 201 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 202 | 203 | throw v0 204 | .end method 205 | 206 | .method private cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;ZI)V 207 | .registers 5 208 | 209 | new-instance v0, Ljava/lang/UnsupportedOperationException; 210 | 211 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 212 | 213 | throw v0 214 | .end method 215 | 216 | .method private cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;ZZ)V 217 | .registers 5 218 | 219 | new-instance v0, Ljava/lang/UnsupportedOperationException; 220 | 221 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 222 | 223 | throw v0 224 | .end method 225 | 226 | .method private final handleAppDiedLocked(Lcom/android/server/am/ProcessRecord;ZZ)V 227 | .registers 5 228 | 229 | invoke-direct {p0, p1, p2, p3}, Lcom/android/server/am/ActivityManagerService;->handleAppDiedLocked$Pr(Lcom/android/server/am/ProcessRecord;ZZ)V 230 | 231 | if-nez p2, :cond_e 232 | 233 | if-eqz p3, :cond_e 234 | 235 | iget-boolean v0, p1, Lcom/android/server/am/ProcessRecord;->killedByAm:Z 236 | 237 | if-nez v0, :cond_e 238 | 239 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->onAppDied(Lcom/android/server/am/ProcessRecord;)V 240 | 241 | :cond_e 242 | return-void 243 | .end method 244 | 245 | .method private final handleAppDiedLocked$Pr(Lcom/android/server/am/ProcessRecord;ZZ)V 246 | .registers 5 247 | 248 | new-instance v0, Ljava/lang/UnsupportedOperationException; 249 | 250 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 251 | 252 | throw v0 253 | .end method 254 | 255 | .method private final handleAppDiedLocked(Lcom/android/server/am/ProcessRecord;ZZZ)V 256 | .registers 5 257 | 258 | invoke-direct {p0, p1, p2, p3, p4}, Lcom/android/server/am/ActivityManagerService;->handleAppDiedLocked$Pr(Lcom/android/server/am/ProcessRecord;ZZZ)V 259 | 260 | if-nez p2, :cond_e 261 | 262 | if-eqz p3, :cond_e 263 | 264 | iget-boolean v0, p1, Lcom/android/server/am/ProcessRecord;->killedByAm:Z 265 | 266 | if-nez v0, :cond_e 267 | 268 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->onAppDied(Lcom/android/server/am/ProcessRecord;)V 269 | 270 | :cond_e 271 | return-void 272 | .end method 273 | 274 | .method private final handleAppDiedLocked$Pr(Lcom/android/server/am/ProcessRecord;ZZZ)V 275 | .registers 5 276 | 277 | new-instance v0, Ljava/lang/UnsupportedOperationException; 278 | 279 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 280 | 281 | throw v0 282 | .end method 283 | 284 | # virtual methods 285 | .method public bindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;II)I 286 | .registers 9 287 | 288 | :try_start_0 289 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 290 | 291 | invoke-static {p1, p2, p3}, Lcom/android/server/am/PreventRunningUtils;->hookBindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;)Z 292 | 293 | move-result v0 294 | 295 | if-eqz v0, :cond_11 296 | 297 | invoke-virtual/range {p0 .. p7}, Lcom/android/server/am/ActivityManagerService;->bindService$Pr(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;II)I 298 | :try_end_c 299 | .catchall {:try_start_0 .. :try_end_c} :catchall_16 300 | 301 | move-result v0 302 | 303 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 304 | 305 | :goto_10 306 | return v0 307 | 308 | :cond_11 309 | const/4 v0, 0x0 310 | 311 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 312 | 313 | goto :goto_10 314 | 315 | :catchall_16 316 | move-exception v0 317 | 318 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 319 | 320 | throw v0 321 | .end method 322 | 323 | .method public bindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;ILjava/lang/String;I)I 324 | .registers 10 325 | 326 | :try_start_0 327 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 328 | 329 | invoke-static {p1, p2, p3}, Lcom/android/server/am/PreventRunningUtils;->hookBindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;)Z 330 | 331 | move-result v0 332 | 333 | if-eqz v0, :cond_11 334 | 335 | invoke-virtual/range {p0 .. p8}, Lcom/android/server/am/ActivityManagerService;->bindService$Pr(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;ILjava/lang/String;I)I 336 | :try_end_c 337 | .catchall {:try_start_0 .. :try_end_c} :catchall_16 338 | 339 | move-result v0 340 | 341 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 342 | 343 | :goto_10 344 | return v0 345 | 346 | :cond_11 347 | const/4 v0, 0x0 348 | 349 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 350 | 351 | goto :goto_10 352 | 353 | :catchall_16 354 | move-exception v0 355 | 356 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 357 | 358 | throw v0 359 | .end method 360 | 361 | .method public bindService$Pr(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;II)I 362 | .registers 9 363 | 364 | new-instance v0, Ljava/lang/UnsupportedOperationException; 365 | 366 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 367 | 368 | throw v0 369 | .end method 370 | 371 | .method public bindService$Pr(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;Ljava/lang/String;Landroid/app/IServiceConnection;ILjava/lang/String;I)I 372 | .registers 10 373 | 374 | new-instance v0, Ljava/lang/UnsupportedOperationException; 375 | 376 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 377 | 378 | throw v0 379 | .end method 380 | 381 | .method public final broadcastIntent(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;Ljava/lang/String;IZZI)I 382 | .registers 14 383 | 384 | :try_start_0 385 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 386 | 387 | invoke-virtual/range {p0 .. p12}, Lcom/android/server/am/ActivityManagerService;->broadcastIntent$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;Ljava/lang/String;IZZI)I 388 | 389 | move-result v0 390 | 391 | if-nez v0, :cond_c 392 | 393 | invoke-static {p2}, Lcom/android/server/am/PreventRunningUtils;->onBroadcastIntent(Landroid/content/Intent;)V 394 | :try_end_c 395 | .catchall {:try_start_0 .. :try_end_c} :catchall_10 396 | 397 | :cond_c 398 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 399 | 400 | return v0 401 | 402 | :catchall_10 403 | move-exception v0 404 | 405 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 406 | 407 | throw v0 408 | .end method 409 | 410 | .method public final broadcastIntent(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;[Ljava/lang/String;ILandroid/os/Bundle;ZZI)I 411 | .registers 15 412 | 413 | :try_start_0 414 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 415 | 416 | invoke-virtual/range {p0 .. p13}, Lcom/android/server/am/ActivityManagerService;->broadcastIntent$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;[Ljava/lang/String;ILandroid/os/Bundle;ZZI)I 417 | 418 | move-result v0 419 | 420 | if-nez v0, :cond_c 421 | 422 | invoke-static {p2}, Lcom/android/server/am/PreventRunningUtils;->onBroadcastIntent(Landroid/content/Intent;)V 423 | :try_end_c 424 | .catchall {:try_start_0 .. :try_end_c} :catchall_10 425 | 426 | :cond_c 427 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 428 | 429 | return v0 430 | 431 | :catchall_10 432 | move-exception v0 433 | 434 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 435 | 436 | throw v0 437 | .end method 438 | 439 | .method public final broadcastIntent$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;Ljava/lang/String;IZZI)I 440 | .registers 14 441 | 442 | new-instance v0, Ljava/lang/UnsupportedOperationException; 443 | 444 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 445 | 446 | throw v0 447 | .end method 448 | 449 | .method public final broadcastIntent$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Landroid/content/IIntentReceiver;ILjava/lang/String;Landroid/os/Bundle;[Ljava/lang/String;ILandroid/os/Bundle;ZZI)I 450 | .registers 15 451 | 452 | new-instance v0, Ljava/lang/UnsupportedOperationException; 453 | 454 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 455 | 456 | throw v0 457 | .end method 458 | 459 | .method getRecordForAppLocked(Landroid/app/IApplicationThread;)Lcom/android/server/am/ProcessRecord; 460 | .registers 3 461 | 462 | new-instance v0, Ljava/lang/UnsupportedOperationException; 463 | 464 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 465 | 466 | throw v0 467 | .end method 468 | 469 | .method public moveActivityTaskToBack(Landroid/os/IBinder;Z)Z 470 | .registers 4 471 | 472 | invoke-virtual {p0, p1, p2}, Lcom/android/server/am/ActivityManagerService;->moveActivityTaskToBack$Pr(Landroid/os/IBinder;Z)Z 473 | 474 | move-result v0 475 | 476 | if-eqz v0, :cond_b 477 | 478 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->onMoveActivityTaskToBack(Landroid/os/IBinder;)V 479 | 480 | const/4 v0, 0x1 481 | 482 | :goto_a 483 | return v0 484 | 485 | :cond_b 486 | const/4 v0, 0x0 487 | 488 | goto :goto_a 489 | .end method 490 | 491 | .method public moveActivityTaskToBack$Pr(Landroid/os/IBinder;Z)Z 492 | .registers 4 493 | 494 | new-instance v0, Ljava/lang/UnsupportedOperationException; 495 | 496 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 497 | 498 | throw v0 499 | .end method 500 | 501 | .method public final startActivity(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;)I 502 | .registers 12 503 | 504 | invoke-virtual/range {p0 .. p10}, Lcom/android/server/am/ActivityManagerService;->startActivity$Pr(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;)I 505 | 506 | move-result v0 507 | 508 | invoke-static {v0, p1, p2, p3}, Lcom/android/server/am/PreventRunningUtils;->onStartActivity(ILandroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;)I 509 | 510 | move-result v0 511 | 512 | return v0 513 | .end method 514 | 515 | .method public final startActivity(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILjava/lang/String;Landroid/os/ParcelFileDescriptor;Landroid/os/Bundle;)I 516 | .registers 13 517 | 518 | invoke-virtual/range {p0 .. p11}, Lcom/android/server/am/ActivityManagerService;->startActivity$Pr(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILjava/lang/String;Landroid/os/ParcelFileDescriptor;Landroid/os/Bundle;)I 519 | 520 | move-result v0 521 | 522 | invoke-static {v0, p1, p2, p3}, Lcom/android/server/am/PreventRunningUtils;->onStartActivity(ILandroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;)I 523 | 524 | move-result v0 525 | 526 | return v0 527 | .end method 528 | 529 | .method public final startActivity$Pr(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILandroid/app/ProfilerInfo;Landroid/os/Bundle;)I 530 | .registers 12 531 | 532 | new-instance v0, Ljava/lang/UnsupportedOperationException; 533 | 534 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 535 | 536 | throw v0 537 | .end method 538 | 539 | .method public final startActivity$Pr(Landroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;Ljava/lang/String;Landroid/os/IBinder;Ljava/lang/String;IILjava/lang/String;Landroid/os/ParcelFileDescriptor;Landroid/os/Bundle;)I 540 | .registers 13 541 | 542 | new-instance v0, Ljava/lang/UnsupportedOperationException; 543 | 544 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 545 | 546 | throw v0 547 | .end method 548 | 549 | .method final startProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;)Lcom/android/server/am/ProcessRecord; 550 | .registers 16 551 | 552 | invoke-static/range {p1 .. p6}, Lcom/android/server/am/PreventRunningUtils;->hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 553 | 554 | move-result v0 555 | 556 | if-eqz v0, :cond_b 557 | 558 | invoke-virtual/range {p0 .. p14}, Lcom/android/server/am/ActivityManagerService;->startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;)Lcom/android/server/am/ProcessRecord; 559 | 560 | move-result-object v0 561 | 562 | :goto_a 563 | return-object v0 564 | 565 | :cond_b 566 | const/4 v0, 0x0 567 | 568 | goto :goto_a 569 | .end method 570 | 571 | .method final startProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;Ljava/lang/String;)Lcom/android/server/am/ProcessRecord; 572 | .registers 18 573 | 574 | invoke-static/range {p1 .. p6}, Lcom/android/server/am/PreventRunningUtils;->hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 575 | 576 | move-result v0 577 | 578 | if-eqz v0, :cond_b 579 | 580 | invoke-virtual/range {p0 .. p15}, Lcom/android/server/am/ActivityManagerService;->startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;Ljava/lang/String;)Lcom/android/server/am/ProcessRecord; 581 | 582 | move-result-object v0 583 | 584 | :goto_a 585 | return-object v0 586 | 587 | :cond_b 588 | const/4 v0, 0x0 589 | 590 | goto :goto_a 591 | .end method 592 | 593 | .method final startProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZ)Lcom/android/server/am/ProcessRecord; 594 | .registers 11 595 | 596 | invoke-static/range {p1 .. p6}, Lcom/android/server/am/PreventRunningUtils;->hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 597 | 598 | move-result v0 599 | 600 | if-eqz v0, :cond_b 601 | 602 | invoke-virtual/range {p0 .. p9}, Lcom/android/server/am/ActivityManagerService;->startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZ)Lcom/android/server/am/ProcessRecord; 603 | 604 | move-result-object v0 605 | 606 | :goto_a 607 | return-object v0 608 | 609 | :cond_b 610 | const/4 v0, 0x0 611 | 612 | goto :goto_a 613 | .end method 614 | 615 | .method final startProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZZ)Lcom/android/server/am/ProcessRecord; 616 | .registers 12 617 | 618 | invoke-static/range {p1 .. p6}, Lcom/android/server/am/PreventRunningUtils;->hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 619 | 620 | move-result v0 621 | 622 | if-eqz v0, :cond_b 623 | 624 | invoke-virtual/range {p0 .. p10}, Lcom/android/server/am/ActivityManagerService;->startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZ)Lcom/android/server/am/ProcessRecord; 625 | 626 | move-result-object v0 627 | 628 | :goto_a 629 | return-object v0 630 | 631 | :cond_b 632 | const/4 v0, 0x0 633 | 634 | goto :goto_a 635 | .end method 636 | 637 | 638 | .method final startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;)Lcom/android/server/am/ProcessRecord; 639 | .registers 16 640 | 641 | new-instance v0, Ljava/lang/UnsupportedOperationException; 642 | 643 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 644 | 645 | throw v0 646 | .end method 647 | 648 | .method final startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZIZLjava/lang/String;Ljava/lang/String;[Ljava/lang/String;Ljava/lang/Runnable;Ljava/lang/String;)Lcom/android/server/am/ProcessRecord; 649 | .registers 18 650 | 651 | new-instance v0, Ljava/lang/UnsupportedOperationException; 652 | 653 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 654 | 655 | throw v0 656 | .end method 657 | 658 | .method final startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZ)Lcom/android/server/am/ProcessRecord; 659 | .registers 11 660 | 661 | new-instance v0, Ljava/lang/UnsupportedOperationException; 662 | 663 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 664 | 665 | throw v0 666 | .end method 667 | 668 | .method final startProcessLocked$Pr(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;ZZZZ)Lcom/android/server/am/ProcessRecord; 669 | .registers 12 670 | 671 | new-instance v0, Ljava/lang/UnsupportedOperationException; 672 | 673 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 674 | 675 | throw v0 676 | .end method 677 | 678 | 679 | .method public startService(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/ComponentName; 680 | .registers 6 681 | 682 | :try_start_0 683 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 684 | 685 | invoke-static {p1, p2}, Lcom/android/server/am/PreventRunningUtils;->hookStartService(Landroid/app/IApplicationThread;Landroid/content/Intent;)Z 686 | 687 | move-result v0 688 | 689 | if-eqz v0, :cond_11 690 | 691 | invoke-virtual {p0, p1, p2, p3, p4}, Lcom/android/server/am/ActivityManagerService;->startService$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/ComponentName; 692 | :try_end_c 693 | .catchall {:try_start_0 .. :try_end_c} :catchall_16 694 | 695 | move-result-object v0 696 | 697 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 698 | 699 | :goto_10 700 | return-object v0 701 | 702 | :cond_11 703 | const/4 v0, 0x0 704 | 705 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 706 | 707 | goto :goto_10 708 | 709 | :catchall_16 710 | move-exception v0 711 | 712 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 713 | 714 | throw v0 715 | .end method 716 | 717 | .method public startService(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;I)Landroid/content/ComponentName; 718 | .registers 7 719 | 720 | :try_start_0 721 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 722 | 723 | invoke-static {p1, p2}, Lcom/android/server/am/PreventRunningUtils;->hookStartService(Landroid/app/IApplicationThread;Landroid/content/Intent;)Z 724 | 725 | move-result v0 726 | 727 | if-eqz v0, :cond_11 728 | 729 | invoke-virtual/range {p0 .. p5}, Lcom/android/server/am/ActivityManagerService;->startService$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;I)Landroid/content/ComponentName; 730 | :try_end_c 731 | .catchall {:try_start_0 .. :try_end_c} :catchall_16 732 | 733 | move-result-object v0 734 | 735 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 736 | 737 | :goto_10 738 | return-object v0 739 | 740 | :cond_11 741 | const/4 v0, 0x0 742 | 743 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 744 | 745 | goto :goto_10 746 | 747 | :catchall_16 748 | move-exception v0 749 | 750 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 751 | 752 | throw v0 753 | .end method 754 | 755 | .method public startService(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;ZLjava/lang/String;I)Landroid/content/ComponentName; 756 | .registers 8 757 | 758 | .prologue 759 | :try_start_0 760 | invoke-static {p1}, Lcom/android/server/am/PreventRunningUtils;->setSender(Landroid/app/IApplicationThread;)V 761 | 762 | invoke-static {p1, p2}, Lcom/android/server/am/PreventRunningUtils;->hookStartService(Landroid/app/IApplicationThread;Landroid/content/Intent;)Z 763 | 764 | move-result v0 765 | 766 | if-eqz v0, :cond_0 767 | 768 | invoke-virtual/range {p0 .. p6}, Lcom/android/server/am/ActivityManagerService;->startService$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;ZLjava/lang/String;I)Landroid/content/ComponentName; 769 | :try_end_0 770 | .catchall {:try_start_0 .. :try_end_0} :catchall_0 771 | 772 | move-result-object v0 773 | 774 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 775 | 776 | return-object v0 777 | 778 | :cond_0 779 | const/4 v0, 0x0 780 | 781 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 782 | 783 | return-object v0 784 | 785 | :catchall_0 786 | move-exception v0 787 | 788 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->clearSender()V 789 | 790 | throw v0 791 | .end method 792 | 793 | .method public startService$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;I)Landroid/content/ComponentName; 794 | .registers 6 795 | 796 | new-instance v0, Ljava/lang/UnsupportedOperationException; 797 | 798 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 799 | 800 | throw v0 801 | .end method 802 | 803 | .method public startService$Pr(Landroid/app/IApplicationThread;Landroid/content/Intent;Ljava/lang/String;Ljava/lang/String;I)Landroid/content/ComponentName; 804 | .registers 7 805 | 806 | new-instance v0, Ljava/lang/UnsupportedOperationException; 807 | 808 | invoke-direct {v0}, Ljava/lang/UnsupportedOperationException;->()V 809 | 810 | throw v0 811 | .end method 812 | -------------------------------------------------------------------------------- /base_jars/apk_oreo/com/android/server/am/ActivityStackSupervisor.smali: -------------------------------------------------------------------------------- 1 | .method cleanUpRemovedTaskLocked(Lcom/android/server/am/TaskRecord;ZZ)V 2 | .registers 6 3 | 4 | .prologue 5 | :try_start_0 6 | invoke-direct {p0, p1, p2, p3}, Lcom/android/server/am/ActivityStackSupervisor;->cleanUpRemovedTaskLocked$Pr(Lcom/android/server/am/TaskRecord;ZZ)V 7 | :try_end_0 8 | .catchall {:try_start_0 .. :try_end_0} :catchall_0 9 | 10 | if-eqz p2, :cond_0 11 | 12 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 13 | 14 | move-result-object v0 15 | 16 | invoke-static {v0}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 17 | 18 | :cond_0 19 | return-void 20 | 21 | :catchall_0 22 | move-exception v0 23 | 24 | if-eqz p2, :cond_1 25 | 26 | invoke-virtual {p1}, Lcom/android/server/am/TaskRecord;->getBaseIntent()Landroid/content/Intent; 27 | 28 | move-result-object v1 29 | 30 | invoke-static {v1}, Lcom/android/server/am/PreventRunningUtils;->onCleanUpRemovedTask(Landroid/content/Intent;)V 31 | 32 | :cond_1 33 | throw v0 34 | .end method 35 | -------------------------------------------------------------------------------- /base_jars/apk_oreo/com/android/server/am/PreventRunning.smali: -------------------------------------------------------------------------------- 1 | .class public Lcom/android/server/am/PreventRunning; 2 | .super Ljava/lang/Object; 3 | .source "PreventRunning.java" 4 | 5 | # interfaces 6 | .implements Lcom/android/server/am/PreventRunningHook; 7 | 8 | 9 | # static fields 10 | .field private static APKS:[Ljava/lang/String; = null 11 | 12 | .field private static final TAG:Ljava/lang/String; = "Prevent" 13 | 14 | .field public static final VERSION:I = 0x133a200 15 | 16 | 17 | # instance fields 18 | .field private mPreventRunning:Lcom/android/server/am/PreventRunningHook; 19 | 20 | 21 | # direct methods 22 | .method static constructor ()V 23 | .registers 3 24 | 25 | const/16 v0, 0x8 26 | 27 | new-array v0, v0, [Ljava/lang/String; 28 | 29 | const/4 v1, 0x0 30 | 31 | const-string v2, "/data/app/me.piebridge.prevent-1/base.apk" 32 | 33 | aput-object v2, v0, v1 34 | 35 | const/4 v1, 0x1 36 | 37 | const-string v2, "/data/app/me.piebridge.prevent-2/base.apk" 38 | 39 | aput-object v2, v0, v1 40 | 41 | const/4 v1, 0x2 42 | 43 | const-string v2, "/data/app/me.piebridge.prevent-3/base.apk" 44 | 45 | aput-object v2, v0, v1 46 | 47 | const/4 v1, 0x3 48 | 49 | const-string v2, "/data/app/me.piebridge.prevent-1.apk" 50 | 51 | aput-object v2, v0, v1 52 | 53 | const/4 v1, 0x4 54 | 55 | const-string v2, "/data/app/me.piebridge.prevent-2.apk" 56 | 57 | aput-object v2, v0, v1 58 | 59 | const/4 v1, 0x5 60 | 61 | const-string v2, "/data/app/me.piebridge.prevent-3.apk" 62 | 63 | aput-object v2, v0, v1 64 | 65 | const/4 v1, 0x6 66 | 67 | const-string v2, "/system/app/Brevent.apk" 68 | 69 | aput-object v2, v0, v1 70 | 71 | const/4 v1, 0x7 72 | 73 | const-string v2, "/system/app/Brevent/Brevent.apk" 74 | 75 | aput-object v2, v0, v1 76 | 77 | sput-object v0, Lcom/android/server/am/PreventRunning;->APKS:[Ljava/lang/String; 78 | 79 | return-void 80 | .end method 81 | 82 | .method public constructor ()V 83 | .registers 6 84 | 85 | invoke-direct {p0}, Ljava/lang/Object;->()V 86 | 87 | sget-object v1, Lcom/android/server/am/PreventRunning;->APKS:[Ljava/lang/String; 88 | 89 | array-length v2, v1 90 | 91 | const/4 v0, 0x0 92 | 93 | :goto_7 94 | if-ge v0, v2, :cond_1c 95 | 96 | aget-object v3, v1, v0 97 | 98 | new-instance v4, Ljava/io/File; 99 | 100 | invoke-direct {v4, v3}, Ljava/io/File;->(Ljava/lang/String;)V 101 | 102 | invoke-virtual {v4}, Ljava/io/File;->exists()Z 103 | 104 | move-result v3 105 | 106 | if-eqz v3, :cond_1d 107 | 108 | invoke-direct {p0, v4}, Lcom/android/server/am/PreventRunning;->initPreventRunning(Ljava/io/File;)Z 109 | 110 | move-result v3 111 | 112 | if-eqz v3, :cond_1d 113 | 114 | :cond_1c 115 | return-void 116 | 117 | :cond_1d 118 | add-int/lit8 v0, v0, 0x1 119 | 120 | goto :goto_7 121 | .end method 122 | 123 | .method private initPreventRunning(Ljava/io/File;)Z 124 | .registers 7 125 | 126 | :try_start_0 127 | invoke-static {}, Ljava/lang/Thread;->currentThread()Ljava/lang/Thread; 128 | 129 | move-result-object v0 130 | 131 | invoke-virtual {v0}, Ljava/lang/Thread;->getContextClassLoader()Ljava/lang/ClassLoader; 132 | 133 | move-result-object v0 134 | 135 | new-instance v1, Ldalvik/system/DexClassLoader; 136 | 137 | invoke-virtual {p1}, Ljava/io/File;->getAbsolutePath()Ljava/lang/String; 138 | 139 | move-result-object v2 140 | 141 | const-string v3, "/cache" 142 | 143 | const/4 v4, 0x0 144 | 145 | invoke-direct {v1, v2, v3, v4, v0}, Ldalvik/system/DexClassLoader;->(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Ljava/lang/ClassLoader;)V 146 | 147 | const-string v0, "Prevent" 148 | 149 | new-instance v2, Ljava/lang/StringBuilder; 150 | 151 | invoke-direct {v2}, Ljava/lang/StringBuilder;->()V 152 | 153 | const-string v3, "loading PreventRunning(20161024) from " 154 | 155 | invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 156 | 157 | move-result-object v2 158 | 159 | invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; 160 | 161 | move-result-object v2 162 | 163 | invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 164 | 165 | move-result-object v2 166 | 167 | invoke-static {v0, v2}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;)I 168 | 169 | const-string v0, "me.piebridge.prevent.framework.PreventRunning" 170 | 171 | invoke-virtual {v1, v0}, Ljava/lang/ClassLoader;->loadClass(Ljava/lang/String;)Ljava/lang/Class; 172 | 173 | move-result-object v0 174 | 175 | invoke-virtual {v0}, Ljava/lang/Class;->newInstance()Ljava/lang/Object; 176 | 177 | move-result-object v0 178 | 179 | check-cast v0, Lcom/android/server/am/PreventRunningHook; 180 | 181 | iput-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 182 | 183 | const v0, 0x133a200 184 | 185 | invoke-virtual {p0, v0}, Lcom/android/server/am/PreventRunning;->setVersion(I)V 186 | 187 | const-string v0, "native" 188 | 189 | invoke-virtual {p0, v0}, Lcom/android/server/am/PreventRunning;->setMethod(Ljava/lang/String;)V 190 | :try_end_45 191 | .catch Ljava/lang/ClassNotFoundException; {:try_start_0 .. :try_end_45} :catch_47 192 | .catch Ljava/lang/InstantiationException; {:try_start_0 .. :try_end_45} :catch_51 193 | .catch Ljava/lang/IllegalAccessException; {:try_start_0 .. :try_end_45} :catch_5a 194 | .catch Ljava/lang/Throwable; {:try_start_0 .. :try_end_45} :catch_63 195 | 196 | const/4 v0, 0x1 197 | 198 | :goto_46 199 | return v0 200 | 201 | :catch_47 202 | move-exception v0 203 | 204 | const-string v1, "Prevent" 205 | 206 | const-string v2, "cannot find class" 207 | 208 | invoke-static {v1, v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I 209 | 210 | :goto_4f 211 | const/4 v0, 0x0 212 | 213 | goto :goto_46 214 | 215 | :catch_51 216 | move-exception v0 217 | 218 | const-string v1, "Prevent" 219 | 220 | const-string v2, "cannot instance class" 221 | 222 | invoke-static {v1, v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I 223 | 224 | goto :goto_4f 225 | 226 | :catch_5a 227 | move-exception v0 228 | 229 | const-string v1, "Prevent" 230 | 231 | const-string v2, "cannot access class" 232 | 233 | invoke-static {v1, v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I 234 | 235 | goto :goto_4f 236 | 237 | :catch_63 238 | move-exception v0 239 | 240 | const-string v1, "Prevent" 241 | 242 | new-instance v2, Ljava/lang/StringBuilder; 243 | 244 | invoke-direct {v2}, Ljava/lang/StringBuilder;->()V 245 | 246 | const-string v3, "cannot load PreventRunning from " 247 | 248 | invoke-virtual {v2, v3}, Ljava/lang/StringBuilder;->append(Ljava/lang/String;)Ljava/lang/StringBuilder; 249 | 250 | move-result-object v2 251 | 252 | invoke-virtual {v2, p1}, Ljava/lang/StringBuilder;->append(Ljava/lang/Object;)Ljava/lang/StringBuilder; 253 | 254 | move-result-object v2 255 | 256 | invoke-virtual {v2}, Ljava/lang/StringBuilder;->toString()Ljava/lang/String; 257 | 258 | move-result-object v2 259 | 260 | invoke-static {v1, v2, v0}, Landroid/util/Log;->d(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)I 261 | 262 | goto :goto_4f 263 | .end method 264 | 265 | 266 | # virtual methods 267 | .method public hookBindService(Landroid/content/Intent;)Z 268 | .registers 3 269 | 270 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 271 | 272 | if-eqz v0, :cond_c 273 | 274 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 275 | 276 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->hookBindService(Landroid/content/Intent;)Z 277 | 278 | move-result v0 279 | 280 | if-eqz v0, :cond_e 281 | 282 | :cond_c 283 | const/4 v0, 0x1 284 | 285 | :goto_d 286 | return v0 287 | 288 | :cond_e 289 | const/4 v0, 0x0 290 | 291 | goto :goto_d 292 | .end method 293 | 294 | .method public hookStartProcessLocked(Landroid/content/Context;Landroid/content/pm/ApplicationInfo;Ljava/lang/String;Landroid/content/ComponentName;)Z 295 | .registers 6 296 | 297 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 298 | 299 | if-eqz v0, :cond_c 300 | 301 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 302 | 303 | invoke-interface {v0, p1, p2, p3, p4}, Lcom/android/server/am/PreventRunningHook;->hookStartProcessLocked(Landroid/content/Context;Landroid/content/pm/ApplicationInfo;Ljava/lang/String;Landroid/content/ComponentName;)Z 304 | 305 | move-result v0 306 | 307 | if-eqz v0, :cond_e 308 | 309 | :cond_c 310 | const/4 v0, 0x1 311 | 312 | :goto_d 313 | return v0 314 | 315 | :cond_e 316 | const/4 v0, 0x0 317 | 318 | goto :goto_d 319 | .end method 320 | 321 | .method public hookStartService(Landroid/content/Intent;)Z 322 | .registers 3 323 | 324 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 325 | 326 | if-eqz v0, :cond_c 327 | 328 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 329 | 330 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->hookStartService(Landroid/content/Intent;)Z 331 | 332 | move-result v0 333 | 334 | if-eqz v0, :cond_e 335 | 336 | :cond_c 337 | const/4 v0, 0x1 338 | 339 | :goto_d 340 | return v0 341 | 342 | :cond_e 343 | const/4 v0, 0x0 344 | 345 | goto :goto_d 346 | .end method 347 | 348 | .method public isActiviated()Z 349 | .registers 2 350 | 351 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 352 | 353 | if-eqz v0, :cond_6 354 | 355 | const/4 v0, 0x1 356 | 357 | :goto_5 358 | return v0 359 | 360 | :cond_6 361 | const/4 v0, 0x0 362 | 363 | goto :goto_5 364 | .end method 365 | 366 | .method public isExcludingStopped(Ljava/lang/String;)Z 367 | .registers 3 368 | 369 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 370 | 371 | if-eqz v0, :cond_c 372 | 373 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 374 | 375 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->isExcludingStopped(Ljava/lang/String;)Z 376 | 377 | move-result v0 378 | 379 | if-eqz v0, :cond_e 380 | 381 | :cond_c 382 | const/4 v0, 0x1 383 | 384 | :goto_d 385 | return v0 386 | 387 | :cond_e 388 | const/4 v0, 0x0 389 | 390 | goto :goto_d 391 | .end method 392 | 393 | .method public match(ILjava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;)I 394 | .registers 16 395 | .annotation system Ldalvik/annotation/Signature; 396 | value = { 397 | "(I", 398 | "Ljava/lang/Object;", 399 | "Ljava/lang/String;", 400 | "Ljava/lang/String;", 401 | "Ljava/lang/String;", 402 | "Landroid/net/Uri;", 403 | "Ljava/util/Set", 404 | "<", 405 | "Ljava/lang/String;", 406 | ">;)I" 407 | } 408 | .end annotation 409 | 410 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 411 | 412 | if-eqz v0, :cond_11 413 | 414 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 415 | 416 | move v1, p1 417 | 418 | move-object v2, p2 419 | 420 | move-object v3, p3 421 | 422 | move-object v4, p4 423 | 424 | move-object v5, p5 425 | 426 | move-object v6, p6 427 | 428 | move-object v7, p7 429 | 430 | invoke-interface/range {v0 .. v7}, Lcom/android/server/am/PreventRunningHook;->match(ILjava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;)I 431 | 432 | move-result p1 433 | 434 | :cond_11 435 | return p1 436 | .end method 437 | 438 | .method public onAppDied(Ljava/lang/Object;)V 439 | .registers 3 440 | 441 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 442 | 443 | if-eqz v0, :cond_9 444 | 445 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 446 | 447 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onAppDied(Ljava/lang/Object;)V 448 | 449 | :cond_9 450 | return-void 451 | .end method 452 | 453 | .method public onBroadcastIntent(Landroid/content/Intent;)V 454 | .registers 3 455 | 456 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 457 | 458 | if-eqz v0, :cond_9 459 | 460 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 461 | 462 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onBroadcastIntent(Landroid/content/Intent;)V 463 | 464 | :cond_9 465 | return-void 466 | .end method 467 | 468 | .method public onCleanUpRemovedTask(Ljava/lang/String;)V 469 | .registers 3 470 | 471 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 472 | 473 | if-eqz v0, :cond_9 474 | 475 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 476 | 477 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onCleanUpRemovedTask(Ljava/lang/String;)V 478 | 479 | :cond_9 480 | return-void 481 | .end method 482 | 483 | .method public onDestroyActivity(Ljava/lang/Object;)V 484 | .registers 3 485 | 486 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 487 | 488 | if-eqz v0, :cond_9 489 | 490 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 491 | 492 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onDestroyActivity(Ljava/lang/Object;)V 493 | 494 | :cond_9 495 | return-void 496 | .end method 497 | 498 | .method public onLaunchActivity(Ljava/lang/Object;)V 499 | .registers 3 500 | 501 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 502 | 503 | if-eqz v0, :cond_9 504 | 505 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 506 | 507 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onLaunchActivity(Ljava/lang/Object;)V 508 | 509 | :cond_9 510 | return-void 511 | .end method 512 | 513 | .method public onMoveActivityTaskToBack(Ljava/lang/String;)V 514 | .registers 3 515 | 516 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 517 | 518 | if-eqz v0, :cond_9 519 | 520 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 521 | 522 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onMoveActivityTaskToBack(Ljava/lang/String;)V 523 | 524 | :cond_9 525 | return-void 526 | .end method 527 | 528 | .method public onResumeActivity(Ljava/lang/Object;)V 529 | .registers 3 530 | 531 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 532 | 533 | if-eqz v0, :cond_9 534 | 535 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 536 | 537 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onResumeActivity(Ljava/lang/Object;)V 538 | 539 | :cond_9 540 | return-void 541 | .end method 542 | 543 | .method public onStartHomeActivity(Ljava/lang/String;)V 544 | .registers 3 545 | 546 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 547 | 548 | if-eqz v0, :cond_9 549 | 550 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 551 | 552 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onStartHomeActivity(Ljava/lang/String;)V 553 | 554 | :cond_9 555 | return-void 556 | .end method 557 | 558 | .method public onUserLeavingActivity(Ljava/lang/Object;)V 559 | .registers 3 560 | 561 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 562 | 563 | if-eqz v0, :cond_9 564 | 565 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 566 | 567 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->onUserLeavingActivity(Ljava/lang/Object;)V 568 | 569 | :cond_9 570 | return-void 571 | .end method 572 | 573 | .method public setMethod(Ljava/lang/String;)V 574 | .registers 3 575 | 576 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 577 | 578 | if-eqz v0, :cond_9 579 | 580 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 581 | 582 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->setMethod(Ljava/lang/String;)V 583 | 584 | :cond_9 585 | return-void 586 | .end method 587 | 588 | .method public setSender(Ljava/lang/String;)V 589 | .registers 3 590 | 591 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 592 | 593 | if-eqz v0, :cond_9 594 | 595 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 596 | 597 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->setSender(Ljava/lang/String;)V 598 | 599 | :cond_9 600 | return-void 601 | .end method 602 | 603 | .method public setVersion(I)V 604 | .registers 3 605 | 606 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 607 | 608 | if-eqz v0, :cond_9 609 | 610 | iget-object v0, p0, Lcom/android/server/am/PreventRunning;->mPreventRunning:Lcom/android/server/am/PreventRunningHook; 611 | 612 | invoke-interface {v0, p1}, Lcom/android/server/am/PreventRunningHook;->setVersion(I)V 613 | 614 | :cond_9 615 | return-void 616 | .end method 617 | -------------------------------------------------------------------------------- /base_jars/apk_oreo/com/android/server/am/PreventRunningHook.smali: -------------------------------------------------------------------------------- 1 | .class public interface abstract Lcom/android/server/am/PreventRunningHook; 2 | .super Ljava/lang/Object; 3 | .source "PreventRunningHook.java" 4 | 5 | 6 | # virtual methods 7 | .method public abstract hookBindService(Landroid/content/Intent;)Z 8 | .end method 9 | 10 | .method public abstract hookStartProcessLocked(Landroid/content/Context;Landroid/content/pm/ApplicationInfo;Ljava/lang/String;Landroid/content/ComponentName;)Z 11 | .end method 12 | 13 | .method public abstract hookStartService(Landroid/content/Intent;)Z 14 | .end method 15 | 16 | .method public abstract isExcludingStopped(Ljava/lang/String;)Z 17 | .end method 18 | 19 | .method public abstract match(ILjava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;)I 20 | .annotation system Ldalvik/annotation/Signature; 21 | value = { 22 | "(I", 23 | "Ljava/lang/Object;", 24 | "Ljava/lang/String;", 25 | "Ljava/lang/String;", 26 | "Ljava/lang/String;", 27 | "Landroid/net/Uri;", 28 | "Ljava/util/Set", 29 | "<", 30 | "Ljava/lang/String;", 31 | ">;)I" 32 | } 33 | .end annotation 34 | .end method 35 | 36 | .method public abstract onAppDied(Ljava/lang/Object;)V 37 | .end method 38 | 39 | .method public abstract onBroadcastIntent(Landroid/content/Intent;)V 40 | .end method 41 | 42 | .method public abstract onCleanUpRemovedTask(Ljava/lang/String;)V 43 | .end method 44 | 45 | .method public abstract onDestroyActivity(Ljava/lang/Object;)V 46 | .end method 47 | 48 | .method public abstract onLaunchActivity(Ljava/lang/Object;)V 49 | .end method 50 | 51 | .method public abstract onMoveActivityTaskToBack(Ljava/lang/String;)V 52 | .end method 53 | 54 | .method public abstract onResumeActivity(Ljava/lang/Object;)V 55 | .end method 56 | 57 | .method public abstract onStartHomeActivity(Ljava/lang/String;)V 58 | .end method 59 | 60 | .method public abstract onUserLeavingActivity(Ljava/lang/Object;)V 61 | .end method 62 | 63 | .method public abstract setMethod(Ljava/lang/String;)V 64 | .end method 65 | 66 | .method public abstract setSender(Ljava/lang/String;)V 67 | .end method 68 | 69 | .method public abstract setVersion(I)V 70 | .end method 71 | -------------------------------------------------------------------------------- /base_jars/apk_oreo/com/android/server/am/PreventRunningUtils.smali: -------------------------------------------------------------------------------- 1 | .class public Lcom/android/server/am/PreventRunningUtils; 2 | .super Ljava/lang/Object; 3 | .source "PreventRunningUtils.java" 4 | 5 | 6 | # static fields 7 | .field private static ams:Lcom/android/server/am/ActivityManagerService; 8 | 9 | .field private static mPreventRunning:Lcom/android/server/am/PreventRunning; 10 | 11 | 12 | # direct methods 13 | .method static constructor ()V 14 | .registers 1 15 | 16 | new-instance v0, Lcom/android/server/am/PreventRunning; 17 | 18 | invoke-direct {v0}, Lcom/android/server/am/PreventRunning;->()V 19 | 20 | sput-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 21 | 22 | return-void 23 | .end method 24 | 25 | .method private constructor ()V 26 | .registers 1 27 | 28 | invoke-direct {p0}, Ljava/lang/Object;->()V 29 | 30 | return-void 31 | .end method 32 | 33 | .method public static clearSender()V 34 | .registers 2 35 | 36 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 37 | 38 | const/4 v1, 0x0 39 | 40 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->setSender(Ljava/lang/String;)V 41 | 42 | return-void 43 | .end method 44 | 45 | .method private static forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 46 | .registers 3 47 | 48 | sget v0, Landroid/os/Build$VERSION;->SDK_INT:I 49 | 50 | const/16 v1, 0x17 51 | 52 | if-lt v0, v1, :cond_b 53 | 54 | invoke-static {p0}, Lcom/android/server/am/ActivityRecord;->forTokenLocked(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 55 | 56 | move-result-object v0 57 | 58 | :goto_a 59 | return-object v0 60 | 61 | :cond_b 62 | invoke-static {p0}, Lcom/android/server/am/ActivityRecord;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 63 | 64 | move-result-object v0 65 | 66 | goto :goto_a 67 | .end method 68 | 69 | .method private static getAms()Lcom/android/server/am/ActivityManagerService; 70 | .registers 1 71 | 72 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->ams:Lcom/android/server/am/ActivityManagerService; 73 | 74 | if-nez v0, :cond_e 75 | 76 | const-string v0, "activity" 77 | 78 | invoke-static {v0}, Landroid/os/ServiceManager;->getService(Ljava/lang/String;)Landroid/os/IBinder; 79 | 80 | move-result-object v0 81 | 82 | check-cast v0, Lcom/android/server/am/ActivityManagerService; 83 | 84 | sput-object v0, Lcom/android/server/am/PreventRunningUtils;->ams:Lcom/android/server/am/ActivityManagerService; 85 | 86 | :cond_e 87 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->ams:Lcom/android/server/am/ActivityManagerService; 88 | 89 | return-object v0 90 | .end method 91 | 92 | .method public static hookBindService(Landroid/app/IApplicationThread;Landroid/os/IBinder;Landroid/content/Intent;)Z 93 | .registers 4 94 | 95 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 96 | 97 | invoke-virtual {v0, p2}, Lcom/android/server/am/PreventRunning;->hookBindService(Landroid/content/Intent;)Z 98 | 99 | move-result v0 100 | 101 | return v0 102 | .end method 103 | 104 | .method public static hookStartProcessLocked(Ljava/lang/String;Landroid/content/pm/ApplicationInfo;ZILjava/lang/String;Landroid/content/ComponentName;)Z 105 | .registers 8 106 | 107 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 108 | 109 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->getAms()Lcom/android/server/am/ActivityManagerService; 110 | 111 | move-result-object v1 112 | 113 | iget-object v1, v1, Lcom/android/server/am/ActivityManagerService;->mContext:Landroid/content/Context; 114 | 115 | invoke-virtual {v0, v1, p1, p4, p5}, Lcom/android/server/am/PreventRunning;->hookStartProcessLocked(Landroid/content/Context;Landroid/content/pm/ApplicationInfo;Ljava/lang/String;Landroid/content/ComponentName;)Z 116 | 117 | move-result v0 118 | 119 | return v0 120 | .end method 121 | 122 | .method public static hookStartService(Landroid/app/IApplicationThread;Landroid/content/Intent;)Z 123 | .registers 3 124 | 125 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 126 | 127 | invoke-virtual {v0, p1}, Lcom/android/server/am/PreventRunning;->hookStartService(Landroid/content/Intent;)Z 128 | 129 | move-result v0 130 | 131 | return v0 132 | .end method 133 | 134 | .method public static isExcludingStopped(Landroid/content/Intent;)Z 135 | .registers 4 136 | 137 | invoke-virtual {p0}, Landroid/content/Intent;->getAction()Ljava/lang/String; 138 | 139 | move-result-object v0 140 | 141 | invoke-virtual {p0}, Landroid/content/Intent;->getFlags()I 142 | 143 | move-result v1 144 | 145 | and-int/lit8 v1, v1, 0x30 146 | 147 | const/16 v2, 0x10 148 | 149 | if-ne v1, v2, :cond_1a 150 | 151 | if-eqz v0, :cond_1a 152 | 153 | sget-object v1, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 154 | 155 | invoke-virtual {v1, v0}, Lcom/android/server/am/PreventRunning;->isExcludingStopped(Ljava/lang/String;)Z 156 | 157 | move-result v0 158 | 159 | if-eqz v0, :cond_1a 160 | 161 | const/4 v0, 0x1 162 | 163 | :goto_19 164 | return v0 165 | 166 | :cond_1a 167 | const/4 v0, 0x0 168 | 169 | goto :goto_19 170 | .end method 171 | 172 | .method public static match(Landroid/content/IntentFilter;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;Ljava/lang/String;)I 173 | .registers 15 174 | .annotation system Ldalvik/annotation/Signature; 175 | value = { 176 | "(", 177 | "Landroid/content/IntentFilter;", 178 | "Ljava/lang/String;", 179 | "Ljava/lang/String;", 180 | "Ljava/lang/String;", 181 | "Landroid/net/Uri;", 182 | "Ljava/util/Set", 183 | "<", 184 | "Ljava/lang/String;", 185 | ">;", 186 | "Ljava/lang/String;", 187 | ")I" 188 | } 189 | .end annotation 190 | 191 | invoke-virtual/range {p0 .. p6}, Landroid/content/IntentFilter;->match(Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;Ljava/lang/String;)I 192 | 193 | move-result v1 194 | 195 | if-ltz v1, :cond_12 196 | 197 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 198 | 199 | move-object v2, p0 200 | 201 | move-object v3, p1 202 | 203 | move-object v4, p2 204 | 205 | move-object v5, p3 206 | 207 | move-object v6, p4 208 | 209 | move-object v7, p5 210 | 211 | invoke-virtual/range {v0 .. v7}, Lcom/android/server/am/PreventRunning;->match(ILjava/lang/Object;Ljava/lang/String;Ljava/lang/String;Ljava/lang/String;Landroid/net/Uri;Ljava/util/Set;)I 212 | 213 | move-result v1 214 | 215 | :cond_12 216 | return v1 217 | .end method 218 | 219 | .method public static onAppDied(Lcom/android/server/am/ProcessRecord;)V 220 | .registers 2 221 | 222 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 223 | 224 | invoke-virtual {v0, p0}, Lcom/android/server/am/PreventRunning;->onAppDied(Ljava/lang/Object;)V 225 | 226 | return-void 227 | .end method 228 | 229 | .method public static onBroadcastIntent(Landroid/content/Intent;)V 230 | .registers 2 231 | 232 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 233 | 234 | invoke-virtual {v0, p0}, Lcom/android/server/am/PreventRunning;->onBroadcastIntent(Landroid/content/Intent;)V 235 | 236 | return-void 237 | .end method 238 | 239 | .method public static onCleanUpRemovedTask(Landroid/content/Intent;)V 240 | .registers 3 241 | 242 | if-eqz p0, :cond_15 243 | 244 | invoke-virtual {p0}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName; 245 | 246 | move-result-object v0 247 | 248 | if-eqz v0, :cond_15 249 | 250 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 251 | 252 | invoke-virtual {p0}, Landroid/content/Intent;->getComponent()Landroid/content/ComponentName; 253 | 254 | move-result-object v1 255 | 256 | invoke-virtual {v1}, Landroid/content/ComponentName;->getPackageName()Ljava/lang/String; 257 | 258 | move-result-object v1 259 | 260 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onCleanUpRemovedTask(Ljava/lang/String;)V 261 | 262 | :cond_15 263 | return-void 264 | .end method 265 | 266 | .method public static onDestroyActivity(Landroid/os/IBinder;)V 267 | .registers 3 268 | 269 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 270 | 271 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 272 | 273 | move-result-object v1 274 | 275 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onDestroyActivity(Ljava/lang/Object;)V 276 | 277 | return-void 278 | .end method 279 | 280 | .method public static onLaunchActivity(Landroid/os/IBinder;)V 281 | .registers 3 282 | 283 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 284 | 285 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 286 | 287 | move-result-object v1 288 | 289 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onLaunchActivity(Ljava/lang/Object;)V 290 | 291 | return-void 292 | .end method 293 | 294 | .method public static onMoveActivityTaskToBack(Landroid/os/IBinder;)V 295 | .registers 3 296 | 297 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 298 | 299 | move-result-object v0 300 | 301 | sget-object v1, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 302 | 303 | if-eqz v0, :cond_e 304 | 305 | iget-object v0, v0, Lcom/android/server/am/ActivityRecord;->packageName:Ljava/lang/String; 306 | 307 | :goto_a 308 | invoke-virtual {v1, v0}, Lcom/android/server/am/PreventRunning;->onMoveActivityTaskToBack(Ljava/lang/String;)V 309 | 310 | return-void 311 | 312 | :cond_e 313 | const/4 v0, 0x0 314 | 315 | goto :goto_a 316 | .end method 317 | 318 | .method public static onResumeActivity(Landroid/os/IBinder;)V 319 | .registers 3 320 | 321 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 322 | 323 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 324 | 325 | move-result-object v1 326 | 327 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onResumeActivity(Ljava/lang/Object;)V 328 | 329 | return-void 330 | .end method 331 | 332 | .method public static onStartActivity(ILandroid/app/IApplicationThread;Ljava/lang/String;Landroid/content/Intent;)I 333 | .registers 6 334 | 335 | if-ltz p0, :cond_27 336 | 337 | if-eqz p3, :cond_27 338 | 339 | const-string v0, "android.intent.category.HOME" 340 | 341 | invoke-virtual {p3, v0}, Landroid/content/Intent;->hasCategory(Ljava/lang/String;)Z 342 | 343 | move-result v0 344 | 345 | if-nez v0, :cond_14 346 | 347 | const-string v0, "android.intent.category.LAUNCHER" 348 | 349 | invoke-virtual {p3, v0}, Landroid/content/Intent;->hasCategory(Ljava/lang/String;)Z 350 | 351 | move-result v0 352 | 353 | if-eqz v0, :cond_27 354 | 355 | :cond_14 356 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->getAms()Lcom/android/server/am/ActivityManagerService; 357 | 358 | move-result-object v0 359 | 360 | invoke-virtual {v0, p1}, Lcom/android/server/am/ActivityManagerService;->getRecordForAppLocked(Landroid/app/IApplicationThread;)Lcom/android/server/am/ProcessRecord; 361 | 362 | move-result-object v0 363 | 364 | if-eqz v0, :cond_27 365 | 366 | sget-object v1, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 367 | 368 | iget-object v0, v0, Lcom/android/server/am/ProcessRecord;->info:Landroid/content/pm/ApplicationInfo; 369 | 370 | iget-object v0, v0, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String; 371 | 372 | invoke-virtual {v1, v0}, Lcom/android/server/am/PreventRunning;->onStartHomeActivity(Ljava/lang/String;)V 373 | 374 | :cond_27 375 | return p0 376 | .end method 377 | 378 | .method public static onUserLeavingActivity(Landroid/os/IBinder;ZZ)V 379 | .registers 5 380 | 381 | if-eqz p2, :cond_b 382 | 383 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 384 | 385 | invoke-static {p0}, Lcom/android/server/am/PreventRunningUtils;->forToken(Landroid/os/IBinder;)Lcom/android/server/am/ActivityRecord; 386 | 387 | move-result-object v1 388 | 389 | invoke-virtual {v0, v1}, Lcom/android/server/am/PreventRunning;->onUserLeavingActivity(Ljava/lang/Object;)V 390 | 391 | :cond_b 392 | return-void 393 | .end method 394 | 395 | .method public static returnFalse()Z 396 | .registers 1 397 | 398 | const/4 v0, 0x0 399 | 400 | return v0 401 | .end method 402 | 403 | .method public static returnFalse(Z)Z 404 | .registers 2 405 | 406 | if-eqz p0, :cond_c 407 | 408 | sget-object v0, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 409 | 410 | invoke-virtual {v0}, Lcom/android/server/am/PreventRunning;->isActiviated()Z 411 | 412 | move-result v0 413 | 414 | if-nez v0, :cond_c 415 | 416 | const/4 v0, 0x1 417 | 418 | :goto_b 419 | return v0 420 | 421 | :cond_c 422 | const/4 v0, 0x0 423 | 424 | goto :goto_b 425 | .end method 426 | 427 | .method public static setSender(Landroid/app/IApplicationThread;)V 428 | .registers 3 429 | 430 | invoke-static {}, Lcom/android/server/am/PreventRunningUtils;->getAms()Lcom/android/server/am/ActivityManagerService; 431 | 432 | move-result-object v0 433 | 434 | invoke-virtual {v0, p0}, Lcom/android/server/am/ActivityManagerService;->getRecordForAppLocked(Landroid/app/IApplicationThread;)Lcom/android/server/am/ProcessRecord; 435 | 436 | move-result-object v0 437 | 438 | sget-object v1, Lcom/android/server/am/PreventRunningUtils;->mPreventRunning:Lcom/android/server/am/PreventRunning; 439 | 440 | if-eqz v0, :cond_14 441 | 442 | iget-object v0, v0, Lcom/android/server/am/ProcessRecord;->info:Landroid/content/pm/ApplicationInfo; 443 | 444 | iget-object v0, v0, Landroid/content/pm/ApplicationInfo;->packageName:Ljava/lang/String; 445 | 446 | :goto_10 447 | invoke-virtual {v1, v0}, Lcom/android/server/am/PreventRunning;->setSender(Ljava/lang/String;)V 448 | 449 | return-void 450 | 451 | :cond_14 452 | invoke-static {}, Landroid/os/Binder;->getCallingUid()I 453 | 454 | move-result v0 455 | 456 | invoke-static {v0}, Ljava/lang/String;->valueOf(I)Ljava/lang/String; 457 | 458 | move-result-object v0 459 | 460 | goto :goto_10 461 | .end method 462 | -------------------------------------------------------------------------------- /base_jars/baksmali.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/baksmali.jar -------------------------------------------------------------------------------- /base_jars/compact_dex_converter_linux_32: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/compact_dex_converter_linux_32 -------------------------------------------------------------------------------- /base_jars/cyggcc_s-seh-1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/cyggcc_s-seh-1.dll -------------------------------------------------------------------------------- /base_jars/cygwin1.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/cygwin1.dll -------------------------------------------------------------------------------- /base_jars/cygz.dll: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/cygz.dll -------------------------------------------------------------------------------- /base_jars/flinux.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/flinux.exe -------------------------------------------------------------------------------- /base_jars/hy.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/hy.apk -------------------------------------------------------------------------------- /base_jars/hy_oreo.apk: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/hy_oreo.apk -------------------------------------------------------------------------------- /base_jars/oat2dex.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/oat2dex.jar -------------------------------------------------------------------------------- /base_jars/patch.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | # Author: Liu DongMiao 4 | 5 | import locale 6 | import os 7 | import sys 8 | import shutil 9 | 10 | MESSAGE_ZH = { 11 | '%s not exists%s': ' --无法找到文件 %s%s', 12 | '%s patched %s%s': ' --成功为 %s 打了 %s 处补丁%s', 13 | '%s patched %s, should patch %s%s': ' --为 %s 打了 %s 处补丁,应该打 %s 处%s', 14 | 'copying %s%s': ' --正在复制 %s%s', 15 | } 16 | 17 | def _(message): 18 | lang, encoding = locale.getdefaultlocale() 19 | translate = MESSAGE_ZH.get(message, message) 20 | if hasattr(translate, 'decode'): 21 | return translate.decode('utf8').encode(encoding) 22 | else: 23 | return translate 24 | 25 | class Patch(object): 26 | def __init__(self, dir_services='services'): 27 | self.dir_services = dir_services 28 | 29 | def build_path(self, paths, dir_path=None): 30 | if dir_path is None: 31 | dir_path = self.dir_services 32 | path = os.path.normpath(dir_path) 33 | for x in paths.split("/"): 34 | path = os.path.join(path, x) 35 | return path 36 | 37 | def run(self): 38 | patched = 0 39 | path = self.build_path(self.get_path()) 40 | if not os.path.exists(path): 41 | sys.stderr.write(_("%s not exists%s") % (path, os.linesep)) 42 | raise SystemExit(1) 43 | 44 | output = open(path + ".patched", "w") 45 | for line in open(path, "r"): 46 | if self.patch(output, line): 47 | patched += 1 48 | else: 49 | output.write(line) 50 | output.close() 51 | # remove .smali 52 | path_name = os.path.basename(path)[:-6] 53 | if patched == self.get_patch_count(): 54 | os.rename(path, path + ".orig") 55 | os.rename(path + ".patched", path) 56 | sys.stdout.write(_("%s patched %s%s") % ( 57 | path_name, patched, os.linesep)) 58 | else: 59 | sys.stderr.write(_("%s patched %s, should patch %s%s") % ( 60 | path_name, patched, self.get_patch_count(), os.linesep)) 61 | raise SystemExit(2) 62 | return patched 63 | 64 | def get_path(self): 65 | raise NotImplemented 66 | 67 | def get_patch_count(self): 68 | raise NotImplemented 69 | 70 | def patch(self, output, line): 71 | raise NotImplemented 72 | 73 | @staticmethod 74 | def find_method_name(line): 75 | end = line.index("(") 76 | start = line.rindex(" ", 0, end) 77 | return line[start + 1:end] 78 | 79 | @staticmethod 80 | def get_method_arguments(line): 81 | start = line.index("{") 82 | end = line.index("}", start) 83 | argument = line[start + 1:end] 84 | if '..' in argument: 85 | start, _, end = [x.strip() for x in argument.partition("..")] 86 | sn = int(start[1:]) 87 | en = int(end[1:]) 88 | assert start[0] == end[0] 89 | prefix = start[0] 90 | arguments = [] 91 | for x in range(sn, en + 1): 92 | arguments.append("%s%d" % (prefix, x)) 93 | return arguments 94 | else: 95 | return [x.strip() for x in argument.split(",")] 96 | 97 | 98 | class IntentResolver(Patch): 99 | def get_path(self): 100 | return "com/android/server/IntentResolver.smali" 101 | 102 | def patch(self, output, line): 103 | if 'Landroid/content/Intent;->isExcludingStopped(' in line: 104 | new_line = line.replace("invoke-virtual/range", "invoke-static/range") \ 105 | .replace("Landroid/content/Intent;->isExcludingStopped(", 106 | "Lcom/android/server/am/PreventRunningUtils;->isExcludingStopped(Landroid/content/Intent;") 107 | output.write(new_line) 108 | return new_line != line 109 | elif 'Landroid/content/IntentFilter;->match(' in line: 110 | new_line = line.replace("invoke-virtual/range", "invoke-static/range") \ 111 | .replace("Landroid/content/IntentFilter;->match(", 112 | "Lcom/android/server/am/PreventRunningUtils;->match(Landroid/content/IntentFilter;") 113 | output.write(new_line) 114 | return new_line != line 115 | 116 | def get_patch_count(self): 117 | return 2 118 | 119 | 120 | class ActivityManagerService(Patch): 121 | methods = None 122 | pkg_deps = '' 123 | extra_count = 0 124 | 125 | fixing = {'startProcessLocked', 'startActivity', 'handleAppDiedLocked', 'cleanUpRemovedTaskLocked', 126 | 'moveActivityTaskToBack', 'startService', 'bindService', 'broadcastIntent'} 127 | 128 | def __init__(self, dir_services=None, dir_apk='apk'): 129 | if dir_services is None: 130 | super(ActivityManagerService, self).__init__() 131 | else: 132 | super(ActivityManagerService, self).__init__(dir_services) 133 | self.dir_apk = dir_apk 134 | self.methods = self.init_pr_methods() 135 | 136 | def get_path(self): 137 | return "com/android/server/am/ActivityManagerService.smali" 138 | 139 | def init_pr_methods(self): 140 | path = self.build_path("com/android/server/am/ActivityManagerService.smali", self.dir_apk) 141 | methods = {} 142 | method_name = method_signature = method_body = '' 143 | for line in open(path, "r"): 144 | line_strip = line.strip() 145 | if line.startswith(".method"): 146 | method_signature = line_strip 147 | method_body = line 148 | method_name = self.find_method_name(method_signature) 149 | elif line.startswith(".end method"): 150 | method_body += line 151 | if method_name in self.fixing: 152 | methods[method_signature] = (method_name, method_body) 153 | method_name = method_signature = method_body = '' 154 | elif line_strip.startswith(".line"): 155 | continue 156 | elif method_signature: 157 | method_body += line 158 | return methods 159 | 160 | def patch(self, output, line): 161 | line_strip = line.strip() 162 | if not line_strip: 163 | return False 164 | 165 | if line_strip.startswith(".line"): 166 | return False 167 | 168 | if line.startswith(".method"): 169 | method_signature = line_strip 170 | if method_signature in self.methods: 171 | method_name, method_body = self.methods[method_signature] 172 | if method_name in self.fixing: 173 | output.write(method_body) 174 | output.write(os.linesep) 175 | output.write(line.replace(method_name, method_name + "$Pr")) 176 | self.fixing.remove(method_name) 177 | return True 178 | 179 | if self.pkg_deps and 'Landroid/util/ArraySet;->contains(Ljava/lang/Object;)Z' in line_strip: 180 | output.write(" invoke-static {}," 181 | " Lcom/android/server/am/PreventRunningUtils;->returnFalse()Z") 182 | output.write(os.linesep) 183 | self.extra_count += 1 184 | self.pkg_deps = '' 185 | return True 186 | 187 | if line_strip.startswith('iget-object'): 188 | if 'Lcom/android/server/am/ProcessRecord;->pkgDeps:Landroid/util/ArraySet;' in line_strip: 189 | self.pkg_deps = line_strip 190 | else: 191 | self.pkg_deps = '' 192 | 193 | def get_patch_count(self): 194 | return 8 + self.extra_count 195 | 196 | def run(self): 197 | super(ActivityManagerService, self).run() 198 | src = self.build_path("com/android/server/am/", self.dir_apk) 199 | dest = self.build_path("com/android/server/am/", self.dir_services) 200 | for path in os.listdir(src): 201 | if path.startswith("PreventRunning"): 202 | sys.stdout.write(_("copying %s%s") % (path[:-6], os.linesep)) 203 | shutil.copy(os.path.join(src, path), dest) 204 | 205 | 206 | class ActivityStack(Patch): 207 | 208 | patched = 0 209 | 210 | def get_path(self): 211 | return "com/android/server/am/ActivityStack.smali" 212 | 213 | def patch(self, output, line): 214 | if "Landroid/app/IApplicationThread;->scheduleResumeActivity(Landroid/os/IBinder;" in line: 215 | output.write(line) 216 | output.write(os.linesep) 217 | argument = self.get_method_arguments(line)[1] 218 | output.write(" invoke-static/range {%s .. %s}," 219 | " Lcom/android/server/am/PreventRunningUtils;" 220 | "->onResumeActivity(Landroid/os/IBinder;)V" % (argument, argument)) 221 | output.write(os.linesep) 222 | self.patched += 1 223 | return True 224 | elif "Landroid/app/IApplicationThread;->scheduleDestroyActivity(Landroid/os/IBinder;" in line: 225 | output.write(line) 226 | output.write(os.linesep) 227 | argument = self.get_method_arguments(line)[1] 228 | output.write(" invoke-static/range {%s .. %s}," 229 | " Lcom/android/server/am/PreventRunningUtils;" 230 | "->onDestroyActivity(Landroid/os/IBinder;)V" % (argument, argument)) 231 | output.write(os.linesep) 232 | self.patched += 1 233 | return True 234 | elif "Landroid/app/IApplicationThread;->schedulePauseActivity(Landroid/os/IBinder;ZZ" in line: 235 | output.write(line) 236 | output.write(os.linesep) 237 | arguments = self.get_method_arguments(line) 238 | if arguments[1][0] == arguments[2][0] == arguments[3][0]: 239 | output.write(" invoke-static/range {%s .. %s}," 240 | " Lcom/android/server/am/PreventRunningUtils;" 241 | "->onUserLeavingActivity(Landroid/os/IBinder;ZZ)V" % (arguments[1], arguments[3])) 242 | else: 243 | output.write(" invoke-static {%s}," 244 | " Lcom/android/server/am/PreventRunningUtils;" 245 | "->onUserLeavingActivity(Landroid/os/IBinder;ZZ)V" % ', '.join(arguments[1:4])) 246 | output.write(os.linesep) 247 | self.patched += 1 248 | return True 249 | 250 | def get_patch_count(self): 251 | if self.patched > 3: 252 | return self.patched 253 | else: 254 | return 3 255 | 256 | 257 | class ActivityStackSupervisor(Patch): 258 | 259 | patched = 0 260 | 261 | def get_path(self): 262 | return "com/android/server/am/ActivityStackSupervisor.smali" 263 | 264 | def patch(self, output, line): 265 | if "Landroid/app/IApplicationThread;->scheduleLaunchActivity(Landroid/content/Intent;Landroid/os/IBinder;" in line: 266 | output.write(line) 267 | output.write(os.linesep) 268 | arguments = self.get_method_arguments(line) 269 | argument = arguments[2] 270 | output.write(" invoke-static/range {%s .. %s}," 271 | " Lcom/android/server/am/PreventRunningUtils;" 272 | "->onLaunchActivity(Landroid/os/IBinder;)V" % (argument, argument)) 273 | output.write(os.linesep) 274 | self.patched += 1 275 | return True 276 | 277 | def get_patch_count(self): 278 | if self.patched > 1: 279 | return self.patched 280 | else: 281 | return 1 282 | 283 | 284 | def main(): 285 | from optparse import OptionParser 286 | 287 | parser = OptionParser() 288 | parser.add_option("-a", "--apk", dest="dir_apk", default="apk", 289 | help="dir for apk", metavar="DIR") 290 | parser.add_option("-s", "--service", dest="dir_services", default="services", 291 | help="dir for services", metavar="DIR") 292 | 293 | (options, args) = parser.parse_args() 294 | 295 | IntentResolver(options.dir_services).run() 296 | ActivityStack(options.dir_services).run() 297 | ActivityStackSupervisor(options.dir_services).run() 298 | ActivityManagerService(options.dir_services, options.dir_apk).run() 299 | 300 | 301 | if __name__ == '__main__': 302 | main() 303 | 304 | # vim: set sta sw=4 et: 305 | -------------------------------------------------------------------------------- /base_jars/patch_oreo.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | # encoding: utf-8 3 | # Author: Liu DongMiao 4 | # Modified By Pzqqt 5 | 6 | import locale 7 | import os 8 | import sys 9 | import shutil 10 | 11 | 12 | plus_flag = False 13 | 14 | MESSAGE_ZH_TW = { 15 | '%s not exists%s': '無法找到檔案 %s%s', 16 | '%s patched %s%s': '成功為 %s 打了 %s 處補丁%s', 17 | '%s patched %s, should patch %s%s': '為 %s 打了 %s 處補丁,應該打 %s 處%s', 18 | 'copying %s%s': '正在拷貝%s%s', 19 | } 20 | 21 | MESSAGE_ZH = { 22 | '%s not exists%s': '无法找到文件 %s%s', 23 | '%s patched %s%s': '成功为 %s 打了 %s 处补丁%s', 24 | '%s patched %s, should patch %s%s': '为 %s 打了 %s 处补丁,应该打 %s 处%s', 25 | 'copying %s%s': '正在复制 %s%s', 26 | } 27 | 28 | def _(message): 29 | # 对要在终端打印的字符串进行翻译和编码(仅在Python 2.x需要编码) 30 | lang, encoding = locale.getdefaultlocale() 31 | if not lang or not lang.startswith("zh"): 32 | return message 33 | if lang.startswith("zh_TW"): 34 | translate = MESSAGE_ZH_TW.get(message, message) 35 | else: 36 | translate = MESSAGE_ZH.get(message, message) 37 | if hasattr(translate, 'decode'): 38 | return translate.decode('utf8').encode(encoding) 39 | else: 40 | return translate 41 | 42 | class Patch(object): 43 | def __init__(self, dir_services='services'): 44 | # services.jar文件反编译后的路径 默认值为services 45 | self.dir_services = dir_services 46 | 47 | def build_path(self, paths, dir_path=None): 48 | # 组合dir_path和paths路径(dir_path + paths) 49 | # 由于paths字符串已定并且使用"/"作为路径分割符 50 | # 所以这样做可以使其同时兼容win平台和Linux平台 51 | if dir_path is None: 52 | # 如果可选参数dir_path没有提供 则使用self.dir_services 53 | # 再往上推 其实就是"services"目录 54 | dir_path = self.dir_services 55 | # os.path.normpath(path)方法:规范path字符串形式 56 | # 例如: 57 | # path = r'D:\A\B\..\C' 58 | # 则 os.path.normpath(path) == r'D:\A\C' 59 | # ~ path = os.path.normpath(dir_path) 60 | # ~ for x in paths.split("/"): 61 | # ~ path = os.path.join(path, x) 62 | # 上面两行代码可以像这样简写为一行吗?可以! 63 | # ~ path = os.path.join(path, *paths.split("/")) 64 | # ~ return path 65 | 66 | # 一行代码 简单粗暴 67 | return os.path.join(os.path.normpath(dir_path), *paths.split("/")) 68 | 69 | def run(self): 70 | patched = 0 71 | # get_path方法定义了要打补丁的文件路径 72 | path = self.build_path(self.get_path()) 73 | if not os.path.exists(path): 74 | sys.stderr.write(_("%s not exists%s") % (path, os.linesep)) 75 | raise SystemExit(1) 76 | 77 | output = open(path + ".patched", "w") 78 | for line in open(path, "r"): 79 | # 打补丁动作在此 80 | # 逐行读取smali文件 并调用patch方法 81 | # 如果打补丁成功 则已打补丁处数(patched)加1 82 | # 否则直接写入*.smali.patched文件 83 | if self.patch(output, line): 84 | patched += 1 85 | else: 86 | output.write(line) 87 | output.close() 88 | # remove .smali 89 | # 移除*.smali文件(实际是重命名为*.smali.orig文件) 90 | # 并将刚才打好补丁的smali文件(*.smali.patched)重命名为*.smali 91 | # os.path.basename(path): 返回文件名 92 | # 此处切片[:-6] 略过字符".smali" 也就是文件后缀 93 | path_name = os.path.basename(path)[:-6] 94 | if patched == self.get_patch_count(): 95 | os.rename(path, path + ".orig") 96 | os.rename(path + ".patched", path) 97 | sys.stdout.write(_("%s patched %s%s") % ( 98 | path_name, patched, os.linesep)) 99 | else: 100 | sys.stderr.write(_("%s patched %s, should patch %s%s") % ( 101 | path_name, patched, self.get_patch_count(), os.linesep)) 102 | raise SystemExit(2) 103 | return patched 104 | 105 | def init_pr_methods(self, fixing, smali_path, dir_apk): 106 | # 初始化Prevent的方法(methods) 107 | # 用意?从apk目录中的指定smali文件中获取所有的method语句体 108 | # 为什么要获取?这是补丁版黑域自己定义的method 109 | # 使用它来替换原本的method以达到劫持的目的 110 | # 此方法在下面的ActivityManagerService类中有使用 111 | path = self.build_path(smali_path, dir_apk) 112 | methods = {} 113 | # method_signature 应该是起到了一个信号的作用 表示method语句的开始 114 | # method_body method完整语句体 最终得到的字符串将包括".method" 和 ".end method"语句 115 | # method_name method名 116 | method_name = method_signature = method_body = '' 117 | for line in open(path, "r"): 118 | line_strip = line.strip() 119 | if line.startswith(".method"): 120 | method_signature = line_strip 121 | method_body = line 122 | method_name = self.find_method_name(method_signature) 123 | elif line.startswith(".end method"): 124 | method_body += line 125 | # 如果method名在预设的fixing集合里 126 | # 则添加元素到methods列表里 127 | if method_name in fixing: 128 | methods[method_signature] = (method_name, method_body) 129 | method_name = method_signature = method_body = '' 130 | elif line_strip.startswith(".line"): 131 | # 跳过".line"行 132 | continue 133 | elif method_signature: 134 | method_body += line 135 | return methods 136 | 137 | def get_path(self): 138 | raise NotImplemented # 预先定义类的方法 直接调用则会... 139 | 140 | def get_patch_count(self): 141 | raise NotImplemented 142 | 143 | def patch(self, output, line): 144 | raise NotImplemented 145 | 146 | @staticmethod # 装饰器 类的静态方法 不会对任何实例类型进行操作 可以理解为此方法与self无关 147 | def find_method_name(line): 148 | # 看起来这个函数是返回smali的方法名的 149 | # 例如: 150 | # line = "method public abstract setVersion(I)V" 151 | # 则调用此函数后返回: "setVersion" 152 | 153 | # 找出字符串line中第一次出现"("的位置索引 154 | end = line.index("(") 155 | # 找出字符串line中最后一次出现" "的位置索引 指定范围:开头(0) -> 第一次出现"("的位置索引(end) 156 | start = line.rindex(" ", 0, end) 157 | # 返回line的切片(start + 1 到 end) 158 | return line[start + 1:end] 159 | 160 | @staticmethod 161 | def get_method_arguments(line): 162 | if line.strip().startswith("iget-object"): 163 | return [a[:-1] for a in line.strip().split()[1:3]] 164 | # 获取smali的method参数 165 | start = line.index("{") 166 | end = line.index("}", start) 167 | argument = line[start + 1:end] 168 | # 如果argument中有".."字符串(省略了一些参数) 169 | # 例如: 170 | # line = "invoke-virtual/range {p0 .. p8}, Lcom/andro(后略)" 171 | # 此时argument = "p0 .. p8" 172 | if '..' in argument: 173 | # 函数partition() 174 | # 作用:按分割符将字符串分割为3部分 返回一个3元的元组 175 | # 第一个为分隔符左边的子串 第二个为分隔符本身 第三个为分隔符右边的子串 176 | # strip() 剔除字符串两侧空白 177 | start, _, end = [x.strip() for x in argument.partition("..")] 178 | sn = int(start[1:]) 179 | en = int(end[1:]) 180 | # 若argument的首尾参数不是以同一字母开头则抛出异常 181 | # 字母?在smali语法中 p开头的寄存器为参数寄存器 v开头的寄存器为本地寄存器 182 | assert start[0] == end[0] 183 | prefix = start[0] 184 | arguments = [] 185 | for x in range(sn, en + 1): 186 | arguments.append("%s%d" % (prefix, x)) 187 | return arguments 188 | else: 189 | return [x.strip() for x in argument.split(",")] 190 | # 最终返回argument包含的所有参数的列表 191 | # 例如: 192 | # argument = "p0, p1, p2, p3" 193 | # 则返回 ["p0", "p1", "p2", "p3"] 194 | # argument = "p0 .. p8" 195 | # 则返回 ["p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8"] 196 | 197 | 198 | class IntentResolver(Patch): # 注意!此类继承于上面的"Patch"类! 199 | 200 | def get_path(self): 201 | # 定义要打补丁的文件相对路径 202 | return "com/android/server/IntentResolver.smali" 203 | 204 | def patch(self, output, line): 205 | if 'Landroid/content/Intent;->isExcludingStopped(' in line: 206 | # 字符串的replace方法 207 | # 方法:replace(旧字符串, 新字符串[, 最大替换次数]) 208 | new_line = line.replace("invoke-virtual/range", "invoke-static/range") \ 209 | .replace("Landroid/content/Intent;->isExcludingStopped(", 210 | "Lcom/android/server/am/PreventRunningUtils;->isExcludingStopped(Landroid/content/Intent;") 211 | output.write(new_line) 212 | # 返回新旧字符串是否相同 用以判断是打补丁是否成功 213 | # 不同则返回True 相同则返回False 214 | return new_line != line 215 | elif 'Landroid/content/IntentFilter;->match(' in line: 216 | new_line = line.replace("invoke-virtual/range", "invoke-static/range") \ 217 | .replace("Landroid/content/IntentFilter;->match(", 218 | "Lcom/android/server/am/PreventRunningUtils;->match(Landroid/content/IntentFilter;") 219 | output.write(new_line) 220 | return new_line != line 221 | # 此处应该有个"return None" 嘛。。。只是便于理解 222 | 223 | def get_patch_count(self): 224 | # 定义应打几处补丁 225 | return 2 226 | 227 | 228 | class ActivityManagerService(Patch): 229 | methods = None 230 | pkg_deps = '' 231 | extra_count = 0 232 | method_name_sp = "" 233 | 234 | # 使用大括号创建了一个仅包含键的字典 称之为集合 235 | # 特点: 检索迅速 不会有重复值 236 | # 这个集合包含了所有要修正的method名 237 | # 即:用补丁版黑域自己的的method替代原本的method 238 | # 原本的method体不动 但method名重命名为"原method名"+"$Pr" 239 | # 至于如何替换 替换为什么样的代码 参考父类的init_pr_methods方法 240 | fixing = {'startProcessLocked', 'startActivity', 'handleAppDiedLocked', 'cleanUpRemovedTaskLocked', 241 | 'moveActivityTaskToBack', 'startService', 'bindService', 'broadcastIntent'} 242 | 243 | def __init__(self, dir_services=None, dir_apk='apk'): 244 | if dir_services is None: 245 | # super() 函数: 用于调用父类(超类)的一个方法 246 | super(ActivityManagerService, self).__init__() 247 | else: 248 | super(ActivityManagerService, self).__init__(dir_services) 249 | self.dir_apk = dir_apk 250 | self.methods = self.init_pr_methods(self.fixing, self.get_path(), self.dir_apk) 251 | 252 | def get_path(self): 253 | return "com/android/server/am/ActivityManagerService.smali" 254 | 255 | def patch(self, output, line): 256 | line_strip = line.strip() 257 | 258 | # 跳过空行 259 | if not line_strip: 260 | return False 261 | 262 | # 跳过".line"行 263 | if line_strip.startswith(".line"): 264 | return False 265 | 266 | if line.startswith(".method"): 267 | method_signature = line_strip 268 | self.method_name_sp = self.find_method_name(line_strip) 269 | # 如果method体第一行在self.methods里也有 270 | if method_signature in self.methods: 271 | # 从self.methods中取出method名和method完整语句体 272 | method_name, method_body = self.methods[method_signature] 273 | # 如果method名在method名修正集合里 274 | if method_name in self.fixing: 275 | # 写入新的method语句体 276 | # 写入一个空行 277 | # 把原本的method语句块的(首行的)method名末尾加上"$Pr" 278 | # 最后从self.fixing中移除此method名 返回True 279 | output.write(method_body) 280 | output.write(os.linesep) 281 | output.write(line.replace(method_name, method_name + "$Pr")) 282 | self.fixing.remove(method_name) 283 | return True 284 | # 此处应该有个"return None" 嘛。。。只是便于理解 285 | # 下面类似的地方就不补充注释了 286 | 287 | # 配合self.pkg_deps这个flag 判断此行是否需要重写 288 | if self.pkg_deps and 'Landroid/util/ArraySet;->contains(Ljava/lang/Object;)Z' in line_strip: 289 | output.write(" invoke-static {}," 290 | " Lcom/android/server/am/PreventRunningUtils;->returnFalse()Z") 291 | output.write(os.linesep) 292 | # 此处patch比较特殊 故使用self.extra_count来特殊计数 293 | # 为什么特殊?此处Patch在4.4下是打不上的 294 | self.extra_count += 1 295 | self.pkg_deps = '' 296 | return True 297 | 298 | # 此处Patch仅用于killPackageProcessesLocked方法 299 | # 在8.x+中 有可能会给getPackageProcessState方法也打上补丁 300 | # 这样做是多余的 所以这里添加一个额外的条件判断 301 | if self.method_name_sp == "killPackageProcessesLocked": 302 | if line_strip.startswith('iget-object'): 303 | # self.pkg_deps用来设置一个flag 因为此行之后的一行需要重写 304 | # 对此行以"iget-object"开头的语句进行判断 305 | if 'Lcom/android/server/am/ProcessRecord;->pkgDeps:Landroid/util/ArraySet;' in line_strip: 306 | self.pkg_deps = line_strip 307 | else: 308 | self.pkg_deps = '' 309 | 310 | def get_patch_count(self): 311 | # 4.4 必打 8+0 处补丁 312 | # 5.x ~ 7.x 必打 8+1 处补丁 313 | # 8.x+ 只打 7+1 处补丁 属于正常情况 314 | global plus_flag 315 | if plus_flag: 316 | return 7 + self.extra_count 317 | else: 318 | return 8 + self.extra_count 319 | 320 | def run(self): 321 | super(ActivityManagerService, self).run() 322 | src = self.build_path("com/android/server/am/", self.dir_apk) 323 | dest = self.build_path("com/android/server/am/", self.dir_services) 324 | # 复制apk目录下文件名以PreventRunning开头的文件 到services目录下(需要复制三个文件) 325 | for path in os.listdir(src): 326 | if path.startswith("PreventRunning"): 327 | sys.stdout.write(_("copying %s%s") % (path[:-6], os.linesep)) 328 | shutil.copy(os.path.join(src, path), dest) 329 | 330 | 331 | class ActivityStack(Patch): 332 | # 此类和IntentResolver类类似 不再详解 333 | 334 | patched = 0 335 | method_name_sp = "" 336 | arg_sp = "" 337 | arg2_sp = "" 338 | 339 | def get_path(self): 340 | return "com/android/server/am/ActivityStack.smali" 341 | 342 | def patch(self, output, line): 343 | # 写得非常不清真的代码 344 | if line.startswith(".method"): 345 | self.method_name_sp = self.find_method_name(line.strip()) 346 | if self.method_name_sp == "resumeTopActivityInnerLocked": 347 | if "Landroid/app/IApplicationThread;->scheduleResumeActivity(Landroid/os/IBinder;" in line: 348 | output.write(line) 349 | output.write(os.linesep) 350 | # 父类定义的get_method_arguments方法: 获取smali的method参数 返回参数列表 351 | # 取此列表的第一个参数赋值给argument变量 352 | argument = self.get_method_arguments(line)[1] 353 | output.write(" invoke-static/range {%s .. %s}," 354 | " Lcom/android/server/am/PreventRunningUtils;" 355 | "->onResumeActivity(Landroid/os/IBinder;)V" % (argument, argument)) 356 | output.write(os.linesep) 357 | self.patched += 1 358 | return True 359 | if line.strip().startswith("invoke-virtual"): 360 | if "Lcom/android/server/am/ActivityRecord;->clearOptionsLocked()V" in line: 361 | self.arg_sp = self.get_method_arguments(line)[0] 362 | if "Lcom/android/server/am/ClientLifecycleManager;->scheduleTransaction" in line: 363 | output.write(line) 364 | output.write(os.linesep) 365 | arguments = self.get_method_arguments(line) 366 | assert self.arg_sp 367 | output.write(" iget-object %s, %s, Lcom/android/server/am/ActivityRecord;" 368 | "->appToken:Landroid/view/IApplicationToken$Stub;" 369 | % (arguments[0], self.arg_sp)) 370 | output.write(os.linesep) 371 | output.write(os.linesep) 372 | output.write(" invoke-static {%s}, Lcom/android/server/am/PreventRunningUtils;" 373 | "->onResumeActivity(Landroid/os/IBinder;)V" % arguments[0]) 374 | output.write(os.linesep) 375 | self.patched += 1 376 | arg_sp = "" 377 | arg2_sp = "" 378 | return True 379 | if self.method_name_sp == "destroyActivityLocked": 380 | if "Landroid/app/IApplicationThread;->scheduleDestroyActivity(Landroid/os/IBinder;" in line: 381 | output.write(line) 382 | output.write(os.linesep) 383 | argument = self.get_method_arguments(line)[1] 384 | output.write(" invoke-static/range {%s .. %s}," 385 | " Lcom/android/server/am/PreventRunningUtils;" 386 | "->onDestroyActivity(Landroid/os/IBinder;)V" % (argument, argument)) 387 | output.write(os.linesep) 388 | self.patched += 1 389 | return True 390 | if line.strip().startswith("iget-object"): 391 | if "Lcom/android/server/am/ActivityRecord;->app:Lcom/android/server/am/ProcessRecord;" in line: 392 | self.arg_sp = self.get_method_arguments(line)[1] 393 | if "Lcom/android/server/am/ClientLifecycleManager;->scheduleTransaction" in line: 394 | output.write(line) 395 | output.write(os.linesep) 396 | arguments = self.get_method_arguments(line) 397 | assert self.arg_sp 398 | output.write(" iget-object %s, %s, Lcom/android/server/am/ActivityRecord;" 399 | "->appToken:Landroid/view/IApplicationToken$Stub;" 400 | % (arguments[0], self.arg_sp)) 401 | output.write(os.linesep) 402 | output.write(os.linesep) 403 | output.write(" invoke-static {%s}, Lcom/android/server/am/PreventRunningUtils;" 404 | "->onDestroyActivity(Landroid/os/IBinder;)V" 405 | % (arguments[0])) 406 | output.write(os.linesep) 407 | self.patched += 1 408 | arg_sp = "" 409 | arg2_sp = "" 410 | return True 411 | if self.method_name_sp == "startPausingLocked": 412 | if "Landroid/app/IApplicationThread;->schedulePauseActivity(Landroid/os/IBinder;ZZ" in line: 413 | output.write(line) 414 | output.write(os.linesep) 415 | arguments = self.get_method_arguments(line) 416 | # 判断参数列表的第2~4个参数是否以同一字母开头 417 | if arguments[1][0] == arguments[2][0] == arguments[3][0]: 418 | output.write(" invoke-static/range {%s .. %s}," 419 | " Lcom/android/server/am/PreventRunningUtils;" 420 | "->onUserLeavingActivity(Landroid/os/IBinder;ZZ)V" % (arguments[1], arguments[3])) 421 | else: 422 | # join函数: 以指定字符串连接序列中的元素 423 | # 语法: str.join(sequence) 424 | # 举例: str = "-"; seq = ("a", "b", "c"); strings = str.join(seq) 425 | # 则 strings == "a-b-c" 426 | output.write(" invoke-static {%s}," 427 | " Lcom/android/server/am/PreventRunningUtils;" 428 | "->onUserLeavingActivity(Landroid/os/IBinder;ZZ)V" % ', '.join(arguments[1:4])) 429 | # 注意: 此处切片[1:4]包含3个元素而不是4个! 430 | output.write(os.linesep) 431 | self.patched += 1 432 | return True 433 | if line.strip().startswith("iget-object"): 434 | if "Lcom/android/server/am/ActivityStack;->mResumedActivity:Lcom/android/server/am/ActivityRecord;" in line: 435 | self.arg_sp = self.get_method_arguments(line)[0] 436 | if "Landroid/app/servertransaction/PauseActivityItem" in line: 437 | self.arg2_sp = self.get_method_arguments(line)[1] 438 | if "Lcom/android/server/am/ClientLifecycleManager;->scheduleTransaction" in line: 439 | output.write(line) 440 | output.write(os.linesep) 441 | arguments = self.get_method_arguments(line) 442 | assert (self.arg_sp and self.arg2_sp) 443 | output.write(" iget-object %s, %s, Lcom/android/server/am/ActivityRecord;" 444 | "->appToken:Landroid/view/IApplicationToken$Stub;" 445 | % (arguments[0], self.arg_sp)) 446 | output.write(os.linesep) 447 | output.write(os.linesep) 448 | output.write(" iget-boolean %s, %s, Lcom/android/server/am/ActivityRecord;->finishing:Z" 449 | % (arguments[1], self.arg_sp)) 450 | output.write(os.linesep) 451 | output.write(os.linesep) 452 | output.write(" invoke-static {%s, %s, %s}, Lcom/android/server/am/PreventRunningUtils;" 453 | "->onUserLeavingActivity(Landroid/os/IBinder;ZZ)V" 454 | % (arguments[0], arguments[1], self.arg2_sp)) 455 | output.write(os.linesep) 456 | self.patched += 1 457 | arg_sp = "" 458 | arg2_sp = "" 459 | return True 460 | 461 | 462 | def get_patch_count(self): 463 | # 打补丁的次数可能会多于3次? 464 | if self.patched > 3: 465 | return self.patched 466 | else: 467 | return 3 468 | 469 | 470 | class ActivityStackSupervisor(Patch): 471 | # 同上 不再详解 472 | 473 | patched = 0 474 | extra_count = 0 475 | 476 | methods = None 477 | fixing = {'cleanUpRemovedTaskLocked',} 478 | arg_sp = "" 479 | 480 | def __init__(self, dir_services=None, dir_apk='apk'): 481 | if dir_services is None: 482 | super(ActivityStackSupervisor, self).__init__() 483 | else: 484 | super(ActivityStackSupervisor, self).__init__(dir_services) 485 | self.dir_apk = dir_apk 486 | self.methods = self.init_pr_methods(self.fixing, self.get_path(), self.dir_apk) 487 | 488 | 489 | def get_path(self): 490 | return "com/android/server/am/ActivityStackSupervisor.smali" 491 | 492 | def patch(self, output, line): 493 | 494 | line_strip = line.strip() 495 | 496 | if not line_strip: 497 | return False 498 | 499 | if line_strip.startswith(".line"): 500 | return False 501 | 502 | if line.startswith(".method"): 503 | method_signature = line_strip 504 | if method_signature in self.methods: 505 | method_name, method_body = self.methods[method_signature] 506 | if method_name in self.fixing: 507 | output.write(method_body) 508 | output.write(os.linesep) 509 | # 注意! 510 | # 这里不仅要把旧的method体的method名末尾加上"$Pr" 511 | # 还要在前面加上"private " 将其转为私有方法 512 | output.write(line.replace(method_name, "private %s$Pr" % method_name)) 513 | self.fixing.remove(method_name) 514 | self.extra_count += 1 515 | self.patched += 1 516 | return True 517 | 518 | if "Landroid/app/IApplicationThread;->scheduleLaunchActivity(Landroid/content/Intent;Landroid/os/IBinder;" in line: 519 | output.write(line) 520 | output.write(os.linesep) 521 | arguments = self.get_method_arguments(line) 522 | argument = arguments[2] 523 | output.write(" invoke-static/range {%s .. %s}," 524 | " Lcom/android/server/am/PreventRunningUtils;" 525 | "->onLaunchActivity(Landroid/os/IBinder;)V" % (argument, argument)) 526 | output.write(os.linesep) 527 | self.patched += 1 528 | return True 529 | 530 | def get_patch_count(self): 531 | if self.extra_count: 532 | global plus_flag 533 | plus_flag = True 534 | # 生成一个flag文件 以帮助bat批处理判断是否是8.x+的services.jar 535 | # 事后删除 536 | # 若并非用于工具自带的批处理 可酌情将下方两行删掉或注释掉 537 | with open("plus_flag.txt", "w") as f: 538 | f.write("plus_flag") 539 | # 7.x以及7.x之前: 1处或N处(加行xN, N>=1) 540 | # 8.x: 1+1处或1+N处(方法Hook + 加行xN, N>=1) 541 | # 9.0: 1处(方法Hook) 542 | if self.patched > 1: 543 | return self.patched 544 | else: 545 | return 1 546 | 547 | 548 | def main(): 549 | # OptionParser这部分就不提了 如感兴趣 自行查阅相关资料 550 | from optparse import OptionParser 551 | 552 | parser = OptionParser() 553 | parser.add_option("-a", "--apk", dest="dir_apk", default="apk", 554 | help="dir for apk", metavar="DIR") 555 | parser.add_option("-s", "--service", dest="dir_services", default="services", 556 | help="dir for services", metavar="DIR") 557 | 558 | (options, args) = parser.parse_args() 559 | 560 | IntentResolver(options.dir_services).run() 561 | ActivityStack(options.dir_services).run() 562 | ActivityStackSupervisor(options.dir_services, options.dir_apk).run() 563 | ActivityManagerService(options.dir_services, options.dir_apk).run() 564 | 565 | 566 | if __name__ == '__main__': 567 | main() 568 | 569 | # vim: set sta sw=4 et: 570 | -------------------------------------------------------------------------------- /base_jars/smali.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/smali.jar -------------------------------------------------------------------------------- /base_jars/vdexExtractor.exe: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/base_jars/vdexExtractor.exe -------------------------------------------------------------------------------- /config: -------------------------------------------------------------------------------- 1 | port <23333> 2 | allow_multiuser 3 | -------------------------------------------------------------------------------- /prevent_server.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Lanthanum-system-toolbox-v2/Prevent-patch-server/06e0ebe3e61c6d46cf858827721e38879af0b4ed/prevent_server.jar -------------------------------------------------------------------------------- /start.bat: -------------------------------------------------------------------------------- 1 | @echo off 2 | java -jar prevent_server.jar 3 | pause --------------------------------------------------------------------------------