2424import android .util .SparseIntArray ;
2525
2626import com .android .internal .annotations .GuardedBy ;
27+ import com .android .internal .gmscompat .GmsCompatLib ;
28+ import com .android .internal .gmscompat .IGmsCompatLib ;
2729import com .android .internal .os .BinderInternal ;
2830
2931import libcore .util .NativeAllocationRegistry ;
@@ -503,10 +505,23 @@ private static class NoImagePreloadHolder {
503505 */
504506 public native boolean isBinderAlive ();
505507
506- /**
507- * Retrieve a local interface - always null in case of a proxy
508- */
508+ private IInterface mLocalInterface ;
509+ private static final IInterface NO_LOCAL_INTERFACE = () -> null ;
510+
509511 public IInterface queryLocalInterface (String descriptor ) {
512+ IGmsCompatLib gmcLib = GmsCompatLib .get ();
513+ if (gmcLib != null ) {
514+ synchronized (this ) {
515+ IInterface cache = mLocalInterface ;
516+ if (cache != null ) {
517+ return cache == NO_LOCAL_INTERFACE ? null : cache ;
518+ }
519+ IInterface res = gmcLib .maybeProvideBinderProxyInterface (this , descriptor );
520+ mLocalInterface = res != null ? res : NO_LOCAL_INTERFACE ;
521+ return res ;
522+ }
523+
524+ }
510525 return null ;
511526 }
512527
@@ -719,6 +734,12 @@ private native boolean removeFrozenStateChangeCallbackNative(
719734 * @throws RemoteException
720735 */
721736 public void dump (FileDescriptor fd , String [] args ) throws RemoteException {
737+ IGmsCompatLib gmcLib = GmsCompatLib .get ();
738+ if (gmcLib != null ) {
739+ if (gmcLib .maybeInterceptBinderProxyDump (this , fd , args , false )) {
740+ return ;
741+ }
742+ }
722743 Parcel data = Parcel .obtain ();
723744 Parcel reply = Parcel .obtain ();
724745 data .writeFileDescriptor (fd );
@@ -740,6 +761,12 @@ public void dump(FileDescriptor fd, String[] args) throws RemoteException {
740761 * @throws RemoteException
741762 */
742763 public void dumpAsync (FileDescriptor fd , String [] args ) throws RemoteException {
764+ IGmsCompatLib gmcLib = GmsCompatLib .get ();
765+ if (gmcLib != null ) {
766+ if (gmcLib .maybeInterceptBinderProxyDump (this , fd , args , true )) {
767+ return ;
768+ }
769+ }
743770 Parcel data = Parcel .obtain ();
744771 Parcel reply = Parcel .obtain ();
745772 data .writeFileDescriptor (fd );
0 commit comments