Closed
Description
I want to call a hidden api in android.view.SurfaceControl.
So I call this in my app module.
Refine.unsafeCast<SurfaceControlHidden>(context.packageManager).internalDisplayToken
And my "hidden-api" module is like
package android.view;
import dev.rikka.tools.refine.RefineAs;
@RefineAs(SurfaceControl.class)
public class SurfaceControlHidden {
private native long[] nativeGetPhysicalDisplayIds();
private native IBinder nativeGetPhysicalDisplayToken(long physicalDisplayId);
public long[] getPhysicalDisplayIds() {
return nativeGetPhysicalDisplayIds();
}
public IBinder getPhysicalDisplayToken(long physicalDisplayId) {
return nativeGetPhysicalDisplayToken(physicalDisplayId);
}
public IBinder getInternalDisplayToken() {
final long[] physicalDisplayIds = getPhysicalDisplayIds();
if (physicalDisplayIds.length == 0) {
return null;
}
return getPhysicalDisplayToken(physicalDisplayIds[0]);
}
}
But when the app actually call the hidden api, it causes
java.lang.ClassCastException: android.app.ApplicationPackageManager cannot be cast to android.view.SurfaceControl
Did I make a mistake somewhere? Please help point it out. Thank you very much.
Metadata
Metadata
Assignees
Labels
No labels