|
33 | 33 | import android.content.res.XmlResourceParser; |
34 | 34 | import android.graphics.Bitmap; |
35 | 35 | import android.graphics.BitmapFactory; |
| 36 | +import android.graphics.Paint; |
36 | 37 | import android.os.Bundle; |
37 | 38 | import android.os.FileUtils; |
38 | 39 | import android.os.Handler; |
@@ -64,6 +65,9 @@ public class TestService extends Service { |
64 | 65 | new MethodCallOp(), new ReadFileOp(), |
65 | 66 | new SchedulerOp(), new SchedulerOp(), |
66 | 67 | new GcOp(), new NoOp(), |
| 68 | + new ObjectGcOp(), new NoOp(), |
| 69 | + new FinalizingGcOp(), new NoOp(), |
| 70 | + new PaintGcOp(), new NoOp(), |
67 | 71 | new IpcOp(), new NoOp(), |
68 | 72 | new IpcOp(), new CpuOp(), |
69 | 73 | new IpcOp(), new SchedulerOp(), |
@@ -111,6 +115,10 @@ public class TestService extends Service { |
111 | 115 | new CpuOp(), |
112 | 116 | new SchedulerOp(), |
113 | 117 | new MethodCallOp(), |
| 118 | + new GcOp(), |
| 119 | + new ObjectGcOp(), |
| 120 | + new FinalizingGcOp(), |
| 121 | + new PaintGcOp(), |
114 | 122 | new IpcOp(), |
115 | 123 | new CreateFileOp(), |
116 | 124 | new CreateWriteFileOp(), |
@@ -467,6 +475,47 @@ boolean onRun() { |
467 | 475 | } |
468 | 476 | } |
469 | 477 |
|
| 478 | + static class ObjectGcOp extends Op { |
| 479 | + ObjectGcOp() { |
| 480 | + super("ObjectGc", "Run garbage collector with simple objects"); |
| 481 | + } |
| 482 | + |
| 483 | + boolean onRun() { |
| 484 | + Object obj = new Object(); |
| 485 | + return true; |
| 486 | + } |
| 487 | + } |
| 488 | + |
| 489 | + static class FinalizingGcOp extends Op { |
| 490 | + class Finalizable { |
| 491 | + Finalizable() {} |
| 492 | + @Override |
| 493 | + protected void finalize() throws Throwable { |
| 494 | + super.finalize(); |
| 495 | + } |
| 496 | + } |
| 497 | + |
| 498 | + FinalizingGcOp() { |
| 499 | + super("FinalizingGc", "Run garbage collector with finalizable objects"); |
| 500 | + } |
| 501 | + |
| 502 | + boolean onRun() { |
| 503 | + Finalizable obj = new Finalizable(); |
| 504 | + return true; |
| 505 | + } |
| 506 | + } |
| 507 | + |
| 508 | + static class PaintGcOp extends Op { |
| 509 | + PaintGcOp() { |
| 510 | + super("PaintGc", "Run garbage collector with Paint objects"); |
| 511 | + } |
| 512 | + |
| 513 | + boolean onRun() { |
| 514 | + Paint p = new Paint(); |
| 515 | + return true; |
| 516 | + } |
| 517 | + } |
| 518 | + |
470 | 519 | static class MethodCallOp extends Op { |
471 | 520 | MethodCallOp() { |
472 | 521 | super("MethodCall", "Method call"); |
|
0 commit comments