|
1 | 1 | package com.genymobile.scrcpy.wrappers;
|
2 | 2 |
|
| 3 | +import com.genymobile.scrcpy.FakeContext; |
3 | 4 | import com.genymobile.scrcpy.Ln;
|
4 | 5 |
|
5 | 6 | import android.content.ClipData;
|
@@ -58,22 +59,22 @@ private Method getSetPrimaryClipMethod() throws NoSuchMethodException {
|
58 | 59 | private static ClipData getPrimaryClip(Method method, boolean alternativeMethod, IInterface manager)
|
59 | 60 | throws InvocationTargetException, IllegalAccessException {
|
60 | 61 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
61 |
| - return (ClipData) method.invoke(manager, ServiceManager.PACKAGE_NAME); |
| 62 | + return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME); |
62 | 63 | }
|
63 | 64 | if (alternativeMethod) {
|
64 |
| - return (ClipData) method.invoke(manager, ServiceManager.PACKAGE_NAME, null, ServiceManager.USER_ID); |
| 65 | + return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, null, ServiceManager.USER_ID); |
65 | 66 | }
|
66 |
| - return (ClipData) method.invoke(manager, ServiceManager.PACKAGE_NAME, ServiceManager.USER_ID); |
| 67 | + return (ClipData) method.invoke(manager, FakeContext.PACKAGE_NAME, ServiceManager.USER_ID); |
67 | 68 | }
|
68 | 69 |
|
69 | 70 | private static void setPrimaryClip(Method method, boolean alternativeMethod, IInterface manager, ClipData clipData)
|
70 | 71 | throws InvocationTargetException, IllegalAccessException {
|
71 | 72 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
72 |
| - method.invoke(manager, clipData, ServiceManager.PACKAGE_NAME); |
| 73 | + method.invoke(manager, clipData, FakeContext.PACKAGE_NAME); |
73 | 74 | } else if (alternativeMethod) {
|
74 |
| - method.invoke(manager, clipData, ServiceManager.PACKAGE_NAME, null, ServiceManager.USER_ID); |
| 75 | + method.invoke(manager, clipData, FakeContext.PACKAGE_NAME, null, ServiceManager.USER_ID); |
75 | 76 | } else {
|
76 |
| - method.invoke(manager, clipData, ServiceManager.PACKAGE_NAME, ServiceManager.USER_ID); |
| 77 | + method.invoke(manager, clipData, FakeContext.PACKAGE_NAME, ServiceManager.USER_ID); |
77 | 78 | }
|
78 | 79 | }
|
79 | 80 |
|
@@ -106,11 +107,11 @@ public boolean setText(CharSequence text) {
|
106 | 107 | private static void addPrimaryClipChangedListener(Method method, boolean alternativeMethod, IInterface manager,
|
107 | 108 | IOnPrimaryClipChangedListener listener) throws InvocationTargetException, IllegalAccessException {
|
108 | 109 | if (Build.VERSION.SDK_INT < Build.VERSION_CODES.Q) {
|
109 |
| - method.invoke(manager, listener, ServiceManager.PACKAGE_NAME); |
| 110 | + method.invoke(manager, listener, FakeContext.PACKAGE_NAME); |
110 | 111 | } else if (alternativeMethod) {
|
111 |
| - method.invoke(manager, listener, ServiceManager.PACKAGE_NAME, null, ServiceManager.USER_ID); |
| 112 | + method.invoke(manager, listener, FakeContext.PACKAGE_NAME, null, ServiceManager.USER_ID); |
112 | 113 | } else {
|
113 |
| - method.invoke(manager, listener, ServiceManager.PACKAGE_NAME, ServiceManager.USER_ID); |
| 114 | + method.invoke(manager, listener, FakeContext.PACKAGE_NAME, ServiceManager.USER_ID); |
114 | 115 | }
|
115 | 116 | }
|
116 | 117 |
|
|
0 commit comments