正在查看: All File Recovery v1.0.2 应用的 h.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
正在查看: All File Recovery v1.0.2 应用的 h.java JAVA 源代码文件
本页面展示 JAVA 反编译生成的源代码文件,支持语法高亮显示。 仅供安全研究与技术分析使用,严禁用于任何非法用途。请遵守相关法律法规。
package s3;
import F.w;
import a2.i0;
import android.annotation.SuppressLint;
import android.app.Service;
import android.content.Context;
import android.content.Intent;
import android.media.browse.MediaBrowser;
import android.media.session.MediaSession;
import android.os.Binder;
import android.os.Build;
import android.os.Bundle;
import android.os.Handler;
import android.os.IBinder;
import android.os.Message;
import android.os.Messenger;
import android.os.Parcel;
import android.os.Parcelable;
import android.os.RemoteException;
import android.service.media.MediaBrowserService;
import android.support.v4.media.MediaBrowserCompat;
import android.support.v4.media.session.MediaSessionCompat;
import android.text.TextUtils;
import android.util.Log;
import androidx.annotation.Nullable;
import java.io.FileDescriptor;
import java.io.PrintWriter;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import l.J;
import l.U;
import l.Z;
import s3.e;
import s3.n;
import s3.o;
@Z({Z.a.a})
@i0
public abstract class h extends Service {
public static final String i = "MBServiceCompat";
public static final boolean j = Log.isLoggable(i, 3);
public static final float k = 1.0E-5f;
public static final String l = "android.media.browse.MediaBrowserService";
public static final String m = "media_item";
public static final String n = "search_results";
public static final int o = 1;
public static final int p = 2;
public static final int q = 4;
public static final int r = -1;
public static final int s = 0;
public static final int t = 1;
public g a;
@Nullable
public f f;
@Nullable
public n.p h;
public final o b = new o();
public final f c = new f("android.media.session.MediaController", -1, -1, null, null);
public final ArrayList<f> d = new ArrayList<>();
public final K.a<IBinder, f> e = new K.a<>();
public final r g = new r(this);
public class a extends m<List<e.n>> {
public final f f;
public final String g;
public final Bundle h;
public final Bundle i;
public a(Object obj, f fVar, String str, Bundle bundle, Bundle bundle2) {
super(obj);
this.f = fVar;
this.g = str;
this.h = bundle;
this.i = bundle2;
}
@Override
public void g(@Nullable List<e.n> list) {
K.a<IBinder, f> aVar = h.this.e;
p pVar = this.f.f;
pVar.getClass();
if (aVar.get(pVar.asBinder()) != this.f) {
if (h.j) {
Log.d(h.i, "Not sending onLoadChildren result for connection that has been disconnected. pkg=" + this.f.a + " id=" + this.g);
return;
}
return;
}
if ((c() & 1) != 0) {
list = h.this.b(list, this.h);
}
try {
this.f.f.a(this.g, list, this.h, this.i);
} catch (RemoteException unused) {
StringBuilder sb = new StringBuilder("Calling onLoadChildren() failed for id=");
sb.append(this.g);
sb.append(" package=");
d0.b.a(sb, this.f.a, h.i);
}
}
}
public class b extends m<e.n> {
public final g.c f;
public b(Object obj, g.c cVar) {
super(obj);
this.f = cVar;
}
@Override
@SuppressLint({"RestrictedApi"})
public void g(@Nullable e.n nVar) {
if ((c() & 2) != 0) {
this.f.b(-1, (Bundle) null);
return;
}
Bundle bundle = new Bundle();
bundle.putParcelable(h.m, s3.d.a(nVar, MediaBrowserCompat.MediaItem.CREATOR));
this.f.b(0, bundle);
}
}
public class c extends m<List<e.n>> {
public final g.c f;
public c(Object obj, g.c cVar) {
super(obj);
this.f = cVar;
}
@Override
@SuppressLint({"RestrictedApi"})
public void g(@Nullable List<e.n> list) {
if ((c() & 4) != 0 || list == null) {
this.f.b(-1, (Bundle) null);
return;
}
Bundle bundle = new Bundle();
bundle.putParcelableArray(h.n, (Parcelable[]) s3.d.b(list, MediaBrowserCompat.MediaItem.CREATOR).toArray(new MediaBrowserCompat.MediaItem[0]));
this.f.b(0, bundle);
}
}
public class d extends m<Bundle> {
public final g.c f;
public d(Object obj, g.c cVar) {
super(obj);
this.f = cVar;
}
@Override
public void e(@Nullable Bundle bundle) {
this.f.b(-1, bundle);
}
@Override
public void f(@Nullable Bundle bundle) {
this.f.b(1, bundle);
}
@Override
public void g(@Nullable Bundle bundle) {
this.f.b(0, bundle);
}
}
public static final class e {
public static final String c = "android.service.media.extra.RECENT";
public static final String d = "android.service.media.extra.OFFLINE";
public static final String e = "android.service.media.extra.SUGGESTED";
@Deprecated
public static final String f = "android.service.media.extra.SUGGESTION_KEYWORDS";
public final String a;
@Nullable
public final Bundle b;
public e(String str, @Nullable Bundle bundle) {
if (str == null) {
throw new IllegalArgumentException("The root id in BrowserRoot cannot be null. Use null for BrowserRoot instead");
}
this.a = str;
this.b = bundle;
}
@Nullable
public Bundle c() {
return this.b;
}
public String d() {
return this.a;
}
}
public class f implements IBinder.DeathRecipient {
@Nullable
public final String a;
public final int b;
public final int c;
public final o.e d;
@Nullable
public final Bundle e;
@Nullable
public final p f;
public final HashMap<String, List<J0.s<IBinder, Bundle>>> g = new HashMap<>();
@Nullable
public e h;
public class a implements Runnable {
public a() {
}
@Override
public void run() {
f fVar = f.this;
K.a<IBinder, f> aVar = h.this.e;
p pVar = fVar.f;
pVar.getClass();
aVar.remove(pVar.asBinder());
}
}
public f(@Nullable String str, int i, int i2, @Nullable Bundle bundle, @Nullable p pVar) {
this.a = str;
this.b = i;
this.c = i2;
this.d = new o.e(str, i, i2);
this.e = bundle;
this.f = pVar;
}
@Override
public void binderDied() {
h.this.g.post(new a());
}
}
public interface g {
o.e a();
void b(String str, @Nullable Bundle bundle);
@Nullable
Bundle c();
void d(n.p pVar);
void e(o.e eVar, String str, Bundle bundle);
@Nullable
IBinder onBind(Intent intent);
void onCreate();
}
@U(21)
public class C0275h implements g {
public final List<Bundle> a = new ArrayList();
public MediaBrowserService b;
public Messenger c;
public class a implements Runnable {
public final n.p a;
public a(n.p pVar) {
this.a = pVar;
}
@Override
public void run() {
C0275h.this.l(this.a);
}
}
public class b extends m<List<e.n>> {
public final n f;
public b(Object obj, n nVar) {
super(obj);
this.f = nVar;
}
@Override
public void b() {
this.f.a();
}
@Override
public void g(@Nullable List<e.n> list) {
ArrayList arrayList;
if (list == null) {
arrayList = null;
} else {
ArrayList arrayList2 = new ArrayList(list.size());
for (e.n nVar : list) {
Parcel obtain = Parcel.obtain();
nVar.writeToParcel(obtain, 0);
arrayList2.add(obtain);
}
arrayList = arrayList2;
}
this.f.c(arrayList);
}
}
public class c implements Runnable {
public final String a;
public final Bundle b;
public c(String str, Bundle bundle) {
this.a = str;
this.b = bundle;
}
@Override
public void run() {
Iterator it = h.this.e.keySet().iterator();
while (it.hasNext()) {
f fVar = (f) h.this.e.get((IBinder) it.next());
fVar.getClass();
C0275h.this.h(fVar, this.a, this.b);
}
}
}
public class d implements Runnable {
public final o.e a;
public final String b;
public final Bundle c;
public d(o.e eVar, String str, Bundle bundle) {
this.a = eVar;
this.b = str;
this.c = bundle;
}
@Override
public void run() {
for (int i = 0; i < h.this.e.size(); i++) {
f fVar = (f) h.this.e.n(i);
if (fVar.d.equals(this.a)) {
C0275h.this.h(fVar, this.b, this.c);
}
}
}
}
@U(21)
public class e extends MediaBrowserService {
public e(Context context) {
attachBaseContext(context);
}
@Override
@Nullable
public MediaBrowserService.BrowserRoot onGetRoot(String str, int i, @Nullable Bundle bundle) {
s3.n.b(bundle);
e j = C0275h.this.j(str, i, bundle == null ? null : new Bundle(bundle));
if (j == null) {
return null;
}
return new MediaBrowserService.BrowserRoot(j.a, j.b);
}
@Override
public void onLoadChildren(String str, MediaBrowserService.Result<List<MediaBrowser.MediaItem>> result) {
C0275h.this.k(str, new n<>(result));
}
}
public C0275h() {
}
@Override
public o.e a() {
f fVar = h.this.f;
if (fVar != null) {
return fVar.d;
}
throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
}
@Override
public void b(String str, @Nullable Bundle bundle) {
i(str, bundle);
f(str, bundle);
}
@Override
@Nullable
public Bundle c() {
if (this.c == null) {
return null;
}
f fVar = h.this.f;
if (fVar == null) {
throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
}
if (fVar.e == null) {
return null;
}
return new Bundle(h.this.f.e);
}
@Override
public void d(n.p pVar) {
h.this.g.a(new a(pVar));
}
@Override
public void e(o.e eVar, String str, Bundle bundle) {
g(eVar, str, bundle);
}
public void f(String str, @Nullable Bundle bundle) {
h.this.g.post(new c(str, bundle));
}
public void g(o.e eVar, String str, Bundle bundle) {
h.this.g.post(new d(eVar, str, bundle));
}
public void h(f fVar, String str, @Nullable Bundle bundle) {
List<J0.s<IBinder, Bundle>> list = fVar.g.get(str);
if (list != null) {
for (J0.s<IBinder, Bundle> sVar : list) {
if (s3.f.b(bundle, (Bundle) sVar.b)) {
h.this.u(str, fVar, (Bundle) sVar.b, bundle);
}
}
}
}
public void i(String str, @Nullable Bundle bundle) {
MediaBrowserService mediaBrowserService = this.b;
mediaBrowserService.getClass();
mediaBrowserService.notifyChildrenChanged(str);
}
@Nullable
public e j(String str, int i, @Nullable Bundle bundle) {
Bundle bundle2;
int i2 = -1;
if (bundle == null || bundle.getInt(s3.g.p, 0) == 0) {
bundle2 = null;
} else {
bundle.remove(s3.g.p);
this.c = new Messenger(h.this.g);
bundle2 = new Bundle();
bundle2.putInt(s3.g.r, 2);
bundle2.putBinder(s3.g.s, this.c.getBinder());
n.p pVar = h.this.h;
if (pVar != null) {
s3.c d2 = pVar.d();
bundle2.putBinder(s3.g.t, d2 == null ? null : d2.asBinder());
} else {
this.a.add(bundle2);
}
i2 = bundle.getInt(s3.g.q, -1);
bundle.remove(s3.g.q);
}
f fVar = h.this.new f(str, i2, i, bundle, null);
h hVar = h.this;
hVar.f = fVar;
e m = hVar.m(str, i, bundle);
h hVar2 = h.this;
hVar2.f = null;
if (m == null) {
return null;
}
if (this.c != null) {
hVar2.d.add(fVar);
}
Bundle bundle3 = m.b;
if (bundle2 == null) {
bundle2 = bundle3;
} else if (bundle3 != null) {
bundle2.putAll(bundle3);
}
return new e(m.a, bundle2);
}
public void k(String str, n<List<Parcel>> nVar) {
b bVar = new b(str, nVar);
h hVar = h.this;
hVar.f = hVar.c;
hVar.n(str, bVar);
h.this.f = null;
}
public void l(n.p pVar) {
if (!this.a.isEmpty()) {
s3.c d2 = pVar.d();
if (d2 != null) {
Iterator<Bundle> it = this.a.iterator();
while (it.hasNext()) {
it.next().putBinder(s3.g.t, d2.asBinder());
}
}
this.a.clear();
}
MediaBrowserService mediaBrowserService = this.b;
mediaBrowserService.getClass();
MediaSession.Token token = (MediaSession.Token) pVar.b;
token.getClass();
mediaBrowserService.setSessionToken(token);
}
@Override
public IBinder onBind(Intent intent) {
MediaBrowserService mediaBrowserService = this.b;
mediaBrowserService.getClass();
return mediaBrowserService.onBind(intent);
}
@Override
public void onCreate() {
e eVar = new e(h.this);
this.b = eVar;
eVar.onCreate();
}
}
@U(23)
public class i extends C0275h {
public class a extends m<e.n> {
public final n f;
public a(Object obj, n nVar) {
super(obj);
this.f = nVar;
}
@Override
public void b() {
this.f.a();
}
@Override
public void g(@Nullable e.n nVar) {
if (nVar == null) {
this.f.c(null);
return;
}
Parcel obtain = Parcel.obtain();
nVar.writeToParcel(obtain, 0);
this.f.c(obtain);
}
}
public class b extends C0275h.e {
public b(Context context) {
super(context);
}
@Override
public void onLoadItem(String str, MediaBrowserService.Result<MediaBrowser.MediaItem> result) {
i.this.m(str, new n<>(result));
}
}
public i() {
super();
}
public void m(String str, n<Parcel> nVar) {
a aVar = new a(str, nVar);
h hVar = h.this;
hVar.f = hVar.c;
hVar.p(str, aVar);
h.this.f = null;
}
@Override
public void onCreate() {
b bVar = new b(h.this);
this.b = bVar;
bVar.onCreate();
}
}
@U(26)
public class j extends i {
public class a extends m<List<e.n>> {
public final n f;
public final Bundle g;
public a(Object obj, n nVar, Bundle bundle) {
super(obj);
this.f = nVar;
this.g = bundle;
}
@Override
public void b() {
this.f.a();
}
@Override
public void g(@Nullable List<e.n> list) {
if (list == null) {
this.f.c(null);
return;
}
if ((c() & 1) != 0) {
list = h.this.b(list, this.g);
}
ArrayList arrayList = new ArrayList(list == null ? 0 : list.size());
if (list != null) {
for (e.n nVar : list) {
Parcel obtain = Parcel.obtain();
nVar.writeToParcel(obtain, 0);
arrayList.add(obtain);
}
}
this.f.c(arrayList);
}
}
public class b extends i.b {
public b(Context context) {
super(context);
}
@Override
public void onLoadChildren(String str, MediaBrowserService.Result<List<MediaBrowser.MediaItem>> result, Bundle bundle) {
s3.n.b(bundle);
j jVar = j.this;
h hVar = h.this;
hVar.f = hVar.c;
jVar.n(str, new n<>(result), bundle);
h.this.f = null;
}
}
public j() {
super();
}
@Override
@Nullable
public Bundle c() {
h hVar = h.this;
f fVar = hVar.f;
if (fVar == null) {
throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
}
if (fVar == hVar.c) {
MediaBrowserService mediaBrowserService = this.b;
mediaBrowserService.getClass();
return mediaBrowserService.getBrowserRootHints();
}
if (fVar.e == null) {
return null;
}
return new Bundle(h.this.f.e);
}
@Override
public void i(String str, @Nullable Bundle bundle) {
if (bundle == null) {
super.i(str, bundle);
return;
}
MediaBrowserService mediaBrowserService = this.b;
mediaBrowserService.getClass();
mediaBrowserService.notifyChildrenChanged(str, bundle);
}
public void n(String str, n<List<Parcel>> nVar, Bundle bundle) {
a aVar = new a(str, nVar, bundle);
h hVar = h.this;
hVar.f = hVar.c;
hVar.o(str, aVar, bundle);
h.this.f = null;
}
@Override
public void onCreate() {
b bVar = new b(h.this);
this.b = bVar;
bVar.onCreate();
}
}
@U(28)
public class k extends j {
public k() {
super();
}
@Override
public o.e a() {
h hVar = h.this;
f fVar = hVar.f;
if (fVar == null) {
throw new IllegalStateException("This should be called inside of onGetRoot, onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
}
if (fVar != hVar.c) {
return fVar.d;
}
MediaBrowserService mediaBrowserService = this.b;
mediaBrowserService.getClass();
return new o.e(T1.g.a(mediaBrowserService));
}
}
public class l implements g {
public Messenger a;
public class a implements Runnable {
public final n.p a;
public a(n.p pVar) {
this.a = pVar;
}
@Override
public void run() {
Iterator it = h.this.e.values().iterator();
while (it.hasNext()) {
f fVar = (f) it.next();
try {
e eVar = fVar.h;
eVar.getClass();
p pVar = fVar.f;
pVar.getClass();
pVar.c(eVar.a, this.a, eVar.b);
} catch (RemoteException unused) {
Log.w(h.i, "Connection for " + fVar.a + " is no longer valid.");
it.remove();
}
}
}
}
public class b implements Runnable {
public final String a;
public final Bundle b;
public b(String str, Bundle bundle) {
this.a = str;
this.b = bundle;
}
@Override
public void run() {
Iterator it = h.this.e.keySet().iterator();
while (it.hasNext()) {
f fVar = (f) h.this.e.get((IBinder) it.next());
fVar.getClass();
l.this.f(fVar, this.a, this.b);
}
}
}
public class c implements Runnable {
public final o.e a;
public final String b;
public final Bundle c;
public c(o.e eVar, String str, Bundle bundle) {
this.a = eVar;
this.b = str;
this.c = bundle;
}
@Override
public void run() {
for (int i = 0; i < h.this.e.size(); i++) {
f fVar = (f) h.this.e.n(i);
if (fVar.d.equals(this.a)) {
l.this.f(fVar, this.b, this.c);
return;
}
}
}
}
public l() {
}
@Override
public o.e a() {
f fVar = h.this.f;
if (fVar != null) {
return fVar.d;
}
throw new IllegalStateException("This should be called inside of onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
}
@Override
public void b(String str, @Nullable Bundle bundle) {
h.this.g.post(new b(str, bundle));
}
@Override
@Nullable
public Bundle c() {
f fVar = h.this.f;
if (fVar == null) {
throw new IllegalStateException("This should be called inside of onLoadChildren, onLoadItem, onSearch, or onCustomAction methods");
}
if (fVar.e == null) {
return null;
}
return new Bundle(h.this.f.e);
}
@Override
public void d(n.p pVar) {
h.this.g.post(new a(pVar));
}
@Override
public void e(o.e eVar, String str, Bundle bundle) {
h.this.g.post(new c(eVar, str, bundle));
}
public void f(f fVar, String str, @Nullable Bundle bundle) {
List<J0.s<IBinder, Bundle>> list = fVar.g.get(str);
if (list != null) {
for (J0.s<IBinder, Bundle> sVar : list) {
if (s3.f.b(bundle, (Bundle) sVar.b)) {
h.this.u(str, fVar, (Bundle) sVar.b, bundle);
}
}
}
}
@Override
@Nullable
public IBinder onBind(Intent intent) {
if (!h.l.equals(intent.getAction())) {
return null;
}
Messenger messenger = this.a;
messenger.getClass();
return messenger.getBinder();
}
@Override
public void onCreate() {
this.a = new Messenger(h.this.g);
}
}
@U(21)
public static class n<T> {
public MediaBrowserService.Result a;
public n(MediaBrowserService.Result result) {
this.a = result;
}
public void a() {
this.a.detach();
}
@Nullable
public List<MediaBrowser.MediaItem> b(List<Parcel> list) {
if (list == null) {
return null;
}
ArrayList arrayList = new ArrayList(list.size());
for (Parcel parcel : list) {
parcel.setDataPosition(0);
arrayList.add((MediaBrowser.MediaItem) MediaBrowser.MediaItem.CREATOR.createFromParcel(parcel));
parcel.recycle();
}
return arrayList;
}
public void c(@Nullable T t) {
if (t instanceof List) {
this.a.sendResult(b((List) t));
return;
}
if (!(t instanceof Parcel)) {
this.a.sendResult(null);
return;
}
Parcel parcel = (Parcel) t;
parcel.setDataPosition(0);
this.a.sendResult(MediaBrowser.MediaItem.CREATOR.createFromParcel(parcel));
parcel.recycle();
}
}
public class o {
public class a implements Runnable {
public final p a;
public final String b;
public final int c;
public final int d;
public final Bundle e;
public a(p pVar, String str, int i, int i2, Bundle bundle) {
this.a = pVar;
this.b = str;
this.c = i;
this.d = i2;
this.e = bundle;
}
@Override
public void run() {
IBinder asBinder = this.a.asBinder();
h.this.e.remove(asBinder);
f fVar = h.this.new f(this.b, this.c, this.d, this.e, this.a);
h hVar = h.this;
hVar.f = fVar;
e m = hVar.m(this.b, this.d, this.e);
fVar.h = m;
h hVar2 = h.this;
hVar2.f = null;
if (m == null) {
Log.i(h.i, "No root for client " + this.b + " from service " + getClass().getName());
try {
this.a.b();
return;
} catch (RemoteException unused) {
d0.b.a(new StringBuilder("Calling onConnectFailed() failed. Ignoring. pkg="), this.b, h.i);
return;
}
}
try {
hVar2.e.put(asBinder, fVar);
asBinder.linkToDeath(fVar, 0);
n.p pVar = h.this.h;
if (pVar != null) {
this.a.c(m.a, pVar, m.b);
}
} catch (RemoteException unused2) {
d0.b.a(new StringBuilder("Calling onConnect() failed. Dropping client. pkg="), this.b, h.i);
h.this.e.remove(asBinder);
}
}
}
public class b implements Runnable {
public final p a;
public b(p pVar) {
this.a = pVar;
}
@Override
public void run() {
f fVar = (f) h.this.e.remove(this.a.asBinder());
if (fVar != null) {
p pVar = fVar.f;
pVar.getClass();
pVar.asBinder().unlinkToDeath(fVar, 0);
}
}
}
public class c implements Runnable {
public final p a;
public final String b;
public final IBinder c;
public final Bundle d;
public c(p pVar, String str, IBinder iBinder, Bundle bundle) {
this.a = pVar;
this.b = str;
this.c = iBinder;
this.d = bundle;
}
@Override
public void run() {
f fVar = (f) h.this.e.get(this.a.asBinder());
if (fVar == null) {
d0.b.a(new StringBuilder("addSubscription for callback that isn't registered id="), this.b, h.i);
} else {
h.this.a(this.b, fVar, this.c, this.d);
}
}
}
public class d implements Runnable {
public final p a;
public final String b;
public final IBinder c;
public d(p pVar, String str, IBinder iBinder) {
this.a = pVar;
this.b = str;
this.c = iBinder;
}
@Override
public void run() {
f fVar = (f) h.this.e.get(this.a.asBinder());
if (fVar == null) {
d0.b.a(new StringBuilder("removeSubscription for callback that isn't registered id="), this.b, h.i);
} else {
if (h.this.x(this.b, fVar, this.c)) {
return;
}
Log.w(h.i, "removeSubscription called for " + this.b + " which is not subscribed");
}
}
}
public class e implements Runnable {
public final p a;
public final String b;
public final g.c c;
public e(p pVar, String str, g.c cVar) {
this.a = pVar;
this.b = str;
this.c = cVar;
}
@Override
public void run() {
f fVar = (f) h.this.e.get(this.a.asBinder());
if (fVar == null) {
d0.b.a(new StringBuilder("getMediaItem for callback that isn't registered id="), this.b, h.i);
} else {
h.this.v(this.b, fVar, this.c);
}
}
}
public class f implements Runnable {
public final p a;
public final int b;
public final String c;
public final int d;
public final Bundle e;
public f(p pVar, int i, String str, int i2, Bundle bundle) {
this.a = pVar;
this.b = i;
this.c = str;
this.d = i2;
this.e = bundle;
}
@Override
public void run() {
f fVar;
IBinder asBinder = this.a.asBinder();
h.this.e.remove(asBinder);
Iterator<f> it = h.this.d.iterator();
while (true) {
if (!it.hasNext()) {
break;
}
f next = it.next();
if (next.c == this.b) {
fVar = (TextUtils.isEmpty(this.c) || this.d <= 0) ? h.this.new f(next.a, next.b, next.c, this.e, this.a) : null;
it.remove();
}
}
if (fVar == null) {
fVar = h.this.new f(this.c, this.d, this.b, this.e, this.a);
}
h.this.e.put(asBinder, fVar);
try {
asBinder.linkToDeath(fVar, 0);
} catch (RemoteException unused) {
Log.w(h.i, "IBinder is already dead.");
}
}
}
public class g implements Runnable {
public final p a;
public g(p pVar) {
this.a = pVar;
}
@Override
public void run() {
IBinder asBinder = this.a.asBinder();
f fVar = (f) h.this.e.remove(asBinder);
if (fVar != null) {
asBinder.unlinkToDeath(fVar, 0);
}
}
}
public class RunnableC0276h implements Runnable {
public final p a;
public final String b;
public final Bundle c;
public final g.c d;
public RunnableC0276h(p pVar, String str, Bundle bundle, g.c cVar) {
this.a = pVar;
this.b = str;
this.c = bundle;
this.d = cVar;
}
@Override
public void run() {
f fVar = (f) h.this.e.get(this.a.asBinder());
if (fVar == null) {
d0.b.a(new StringBuilder("search for callback that isn't registered query="), this.b, h.i);
} else {
h.this.w(this.b, this.c, fVar, this.d);
}
}
}
public class i implements Runnable {
public final p a;
public final String b;
public final Bundle c;
public final g.c d;
public i(p pVar, String str, Bundle bundle, g.c cVar) {
this.a = pVar;
this.b = str;
this.c = bundle;
this.d = cVar;
}
@Override
public void run() {
f fVar = (f) h.this.e.get(this.a.asBinder());
if (fVar != null) {
h.this.t(this.b, this.c, fVar, this.d);
return;
}
Log.w(h.i, "sendCustomAction for callback that isn't registered action=" + this.b + ", extras=" + this.c);
}
}
public o() {
}
public void a(@Nullable String str, @Nullable IBinder iBinder, @Nullable Bundle bundle, p pVar) {
h.this.g.a(new c(pVar, str, iBinder, bundle));
}
public void b(@Nullable String str, int i2, int i3, @Nullable Bundle bundle, p pVar) {
if (h.this.h(str, i3)) {
h.this.g.a(new a(pVar, str, i2, i3, bundle));
return;
}
throw new IllegalArgumentException("Package/uid mismatch: uid=" + i3 + " package=" + str);
}
public void c(p pVar) {
h.this.g.a(new b(pVar));
}
public void d(@Nullable String str, @Nullable g.c cVar, p pVar) {
if (TextUtils.isEmpty(str) || cVar == null) {
return;
}
h.this.g.a(new e(pVar, str, cVar));
}
public void e(p pVar, @Nullable String str, int i2, int i3, @Nullable Bundle bundle) {
h.this.g.a(new f(pVar, i3, str, i2, bundle));
}
public void f(@Nullable String str, @Nullable IBinder iBinder, p pVar) {
h.this.g.a(new d(pVar, str, iBinder));
}
public void g(@Nullable String str, @Nullable Bundle bundle, @Nullable g.c cVar, p pVar) {
if (TextUtils.isEmpty(str) || cVar == null) {
return;
}
h.this.g.a(new RunnableC0276h(pVar, str, bundle, cVar));
}
public void h(@Nullable String str, @Nullable Bundle bundle, @Nullable g.c cVar, p pVar) {
if (TextUtils.isEmpty(str) || cVar == null) {
return;
}
h.this.g.a(new i(pVar, str, bundle, cVar));
}
public void i(p pVar) {
h.this.g.a(new g(pVar));
}
}
public interface p {
void a(@Nullable String str, @Nullable List<e.n> list, @Nullable Bundle bundle, @Nullable Bundle bundle2) throws RemoteException;
IBinder asBinder();
void b() throws RemoteException;
void c(String str, @Nullable n.p pVar, @Nullable Bundle bundle) throws RemoteException;
}
public static class q implements p {
public final Messenger a;
public q(Messenger messenger) {
this.a = messenger;
}
@Override
public void a(@Nullable String str, @Nullable List<e.n> list, @Nullable Bundle bundle, @Nullable Bundle bundle2) throws RemoteException {
Bundle bundle3 = new Bundle();
bundle3.putString(s3.g.d, str);
bundle3.putBundle(s3.g.g, bundle);
bundle3.putBundle(s3.g.h, bundle2);
if (list != null) {
bundle3.putParcelableArrayList(s3.g.e, s3.d.b(list, MediaBrowserCompat.MediaItem.CREATOR));
}
d(3, bundle3);
}
@Override
public IBinder asBinder() {
return this.a.getBinder();
}
@Override
public void b() throws RemoteException {
d(2, null);
}
@Override
public void c(String str, @Nullable n.p pVar, @Nullable Bundle bundle) throws RemoteException {
if (bundle == null) {
bundle = new Bundle();
}
bundle.putInt(s3.g.r, 2);
Bundle bundle2 = new Bundle();
bundle2.putString(s3.g.d, str);
bundle2.putParcelable(s3.g.f, s3.d.a(pVar, MediaSessionCompat.Token.CREATOR));
bundle2.putBundle(s3.g.k, bundle);
d(1, bundle2);
}
public final void d(int i, @Nullable Bundle bundle) throws RemoteException {
Message obtain = Message.obtain();
obtain.what = i;
obtain.arg1 = 2;
if (bundle != null) {
obtain.setData(bundle);
}
this.a.send(obtain);
}
}
public static final class r extends Handler {
@Nullable
public h a;
@J
public r(h hVar) {
this.a = hVar;
}
public void a(Runnable runnable) {
if (Thread.currentThread() == getLooper().getThread()) {
runnable.run();
} else {
post(runnable);
}
}
@J
public void b() {
this.a = null;
}
@Override
@J
public void handleMessage(Message message) {
h hVar = this.a;
if (hVar != null) {
hVar.g(message);
} else {
removeCallbacksAndMessages(null);
}
}
@Override
public boolean sendMessageAtTime(Message message, long j) {
Bundle data = message.getData();
ClassLoader classLoader = s3.e.class.getClassLoader();
classLoader.getClass();
data.setClassLoader(classLoader);
data.putInt("data_calling_uid", Binder.getCallingUid());
int callingPid = Binder.getCallingPid();
if (callingPid > 0) {
data.putInt("data_calling_pid", callingPid);
} else if (!data.containsKey("data_calling_pid")) {
data.putInt("data_calling_pid", -1);
}
return super.sendMessageAtTime(message, j);
}
}
public void a(@Nullable String str, f fVar, @Nullable IBinder iBinder, @Nullable Bundle bundle) {
List<J0.s<IBinder, Bundle>> list = fVar.g.get(str);
if (list == null) {
list = new ArrayList<>();
}
for (J0.s<IBinder, Bundle> sVar : list) {
if (iBinder == sVar.a && s3.f.a(bundle, (Bundle) sVar.b)) {
return;
}
}
list.add(new J0.s<>(iBinder, bundle));
fVar.g.put(str, list);
u(str, fVar, bundle, null);
this.f = fVar;
r(str, bundle);
this.f = null;
}
@Nullable
public List<e.n> b(@Nullable List<e.n> list, @Nullable Bundle bundle) {
if (list == null) {
return null;
}
if (bundle != null) {
int i2 = bundle.getInt(s3.e.d, -1);
int i3 = bundle.getInt(s3.e.e, -1);
if (i2 != -1 || i3 != -1) {
int i6 = i3 * i2;
int i7 = i6 + i3;
if (i2 < 0 || i3 < 1 || i6 >= list.size()) {
return Collections.EMPTY_LIST;
}
if (i7 > list.size()) {
i7 = list.size();
}
return list.subList(i6, i7);
}
}
return list;
}
public void c(Context context) {
attachBaseContext(context);
}
@Nullable
public final Bundle d() {
g gVar = this.a;
gVar.getClass();
return gVar.c();
}
public final o.e e() {
g gVar = this.a;
gVar.getClass();
return gVar.a();
}
@Nullable
public n.p f() {
return this.h;
}
@SuppressLint({"RestrictedApi"})
public void g(Message message) {
Bundle data = message.getData();
switch (message.what) {
case 1:
Bundle bundle = data.getBundle(s3.g.k);
s3.n.b(bundle);
this.b.b(data.getString(s3.g.i), data.getInt("data_calling_pid"), data.getInt("data_calling_uid"), bundle, new q(message.replyTo));
break;
case 2:
this.b.c(new q(message.replyTo));
break;
case 3:
Bundle bundle2 = data.getBundle(s3.g.g);
s3.n.b(bundle2);
this.b.a(data.getString(s3.g.d), data.getBinder(s3.g.a), bundle2, new q(message.replyTo));
break;
case 4:
this.b.f(data.getString(s3.g.d), data.getBinder(s3.g.a), new q(message.replyTo));
break;
case 5:
this.b.d(data.getString(s3.g.d), (g.c) data.getParcelable(s3.g.j), new q(message.replyTo));
break;
case 6:
Bundle bundle3 = data.getBundle(s3.g.k);
s3.n.b(bundle3);
this.b.e(new q(message.replyTo), data.getString(s3.g.i), data.getInt("data_calling_pid"), data.getInt("data_calling_uid"), bundle3);
break;
case 7:
this.b.i(new q(message.replyTo));
break;
case 8:
Bundle bundle4 = data.getBundle(s3.g.l);
s3.n.b(bundle4);
this.b.g(data.getString(s3.g.m), bundle4, (g.c) data.getParcelable(s3.g.j), new q(message.replyTo));
break;
case 9:
Bundle bundle5 = data.getBundle(s3.g.o);
s3.n.b(bundle5);
this.b.h(data.getString(s3.g.n), bundle5, (g.c) data.getParcelable(s3.g.j), new q(message.replyTo));
break;
default:
Log.w(i, "Unhandled message: " + message + "\n Service version: 2\n Client version: " + message.arg1);
break;
}
}
@ze.e(expression = {"#1"}, result = true)
public boolean h(@Nullable String str, int i2) {
String[] packagesForUid;
if (str == null || (packagesForUid = getPackageManager().getPackagesForUid(i2)) == null) {
return false;
}
for (String str2 : packagesForUid) {
if (str2.equals(str)) {
return true;
}
}
return false;
}
public void i(String str) {
if (str == null) {
throw new IllegalArgumentException("parentId cannot be null in notifyChildrenChanged");
}
g gVar = this.a;
gVar.getClass();
gVar.b(str, null);
}
public void j(String str, Bundle bundle) {
if (str == null) {
throw new IllegalArgumentException("parentId cannot be null in notifyChildrenChanged");
}
if (bundle == null) {
throw new IllegalArgumentException("options cannot be null in notifyChildrenChanged");
}
g gVar = this.a;
gVar.getClass();
gVar.b(str, bundle);
}
public void k(o.e eVar, String str, Bundle bundle) {
if (eVar == null) {
throw new IllegalArgumentException("remoteUserInfo cannot be null in notifyChildrenChanged");
}
if (str == null) {
throw new IllegalArgumentException("parentId cannot be null in notifyChildrenChanged");
}
if (bundle == null) {
throw new IllegalArgumentException("options cannot be null in notifyChildrenChanged");
}
g gVar = this.a;
gVar.getClass();
gVar.e(eVar, str, bundle);
}
public void l(String str, Bundle bundle, m<Bundle> mVar) {
mVar.h(null);
}
@Nullable
public abstract e m(@Nullable String str, int i2, @Nullable Bundle bundle);
public abstract void n(@Nullable String str, m<List<e.n>> mVar);
public void o(@Nullable String str, m<List<e.n>> mVar, Bundle bundle) {
mVar.k(1);
n(str, mVar);
}
@Override
@Nullable
public IBinder onBind(Intent intent) {
g gVar = this.a;
gVar.getClass();
return gVar.onBind(intent);
}
@Override
public void onCreate() {
super.onCreate();
int i2 = Build.VERSION.SDK_INT;
if (i2 >= 28) {
this.a = new k();
} else if (i2 >= 26) {
this.a = new j();
} else {
this.a = new i();
}
this.a.onCreate();
}
@Override
@J
@l.i
public void onDestroy() {
this.g.a = null;
}
public void p(String str, m<e.n> mVar) {
mVar.k(2);
mVar.j(null);
}
public void q(String str, @Nullable Bundle bundle, m<List<e.n>> mVar) {
mVar.k(4);
mVar.j(null);
}
public void t(String str, @Nullable Bundle bundle, f fVar, g.c cVar) {
d dVar = new d(str, cVar);
this.f = fVar;
l(str, bundle == null ? Bundle.EMPTY : bundle, dVar);
this.f = null;
if (dVar.d()) {
return;
}
throw new IllegalStateException("onCustomAction must call detach() or sendResult() or sendError() before returning for action=" + str + " extras=" + bundle);
}
public void u(@Nullable String str, f fVar, @Nullable Bundle bundle, @Nullable Bundle bundle2) {
a aVar = new a(str, fVar, str, bundle, bundle2);
this.f = fVar;
if (bundle == null) {
n(str, aVar);
} else {
o(str, aVar, bundle);
}
this.f = null;
if (!aVar.d()) {
throw new IllegalStateException(g1.c.a(new StringBuilder("onLoadChildren must call detach() or sendResult() before returning for package="), fVar.a, " id=", str));
}
}
public void v(String str, f fVar, g.c cVar) {
b bVar = new b(str, cVar);
this.f = fVar;
p(str, bVar);
this.f = null;
if (!bVar.d()) {
throw new IllegalStateException(w.a("onLoadItem must call detach() or sendResult() before returning for id=", str));
}
}
public void w(String str, @Nullable Bundle bundle, f fVar, g.c cVar) {
c cVar2 = new c(str, cVar);
this.f = fVar;
q(str, bundle, cVar2);
this.f = null;
if (!cVar2.d()) {
throw new IllegalStateException(w.a("onSearch must call detach() or sendResult() before returning for query=", str));
}
}
public boolean x(@Nullable String str, f fVar, @Nullable IBinder iBinder) {
boolean z = false;
try {
if (iBinder != null) {
List<J0.s<IBinder, Bundle>> list = fVar.g.get(str);
if (list != null) {
Iterator<J0.s<IBinder, Bundle>> it = list.iterator();
while (it.hasNext()) {
if (iBinder == it.next().a) {
it.remove();
z = true;
}
}
if (list.size() == 0) {
fVar.g.remove(str);
}
}
} else if (fVar.g.remove(str) != null) {
z = true;
}
return z;
} finally {
this.f = fVar;
s(str);
this.f = null;
}
}
public void y(n.p pVar) {
if (pVar == null) {
throw new IllegalArgumentException("Session token may not be null");
}
if (this.h != null) {
throw new IllegalStateException("The session token has already been set");
}
this.h = pVar;
g gVar = this.a;
gVar.getClass();
gVar.d(pVar);
}
public static class m<T> {
@Nullable
public final Object a;
public boolean b;
public boolean c;
public boolean d;
public int e;
public m(@Nullable Object obj) {
this.a = obj;
}
public final void a(@Nullable Bundle bundle) {
if (bundle != null && bundle.containsKey(s3.e.g)) {
float f = bundle.getFloat(s3.e.g);
if (f < -1.0E-5f || f > 1.00001f) {
throw new IllegalArgumentException("The value of the EXTRA_DOWNLOAD_PROGRESS field must be a float number within [0.0, 1.0]");
}
}
}
public void b() {
if (this.b) {
throw new IllegalStateException("detach() called when detach() had already been called for: " + this.a);
}
if (this.c) {
throw new IllegalStateException("detach() called when sendResult() had already been called for: " + this.a);
}
if (!this.d) {
this.b = true;
} else {
throw new IllegalStateException("detach() called when sendError() had already been called for: " + this.a);
}
}
public int c() {
return this.e;
}
public boolean d() {
return this.b || this.c || this.d;
}
public void e(@Nullable Bundle bundle) {
throw new UnsupportedOperationException("It is not supported to send an error for " + this.a);
}
public void f(@Nullable Bundle bundle) {
throw new UnsupportedOperationException("It is not supported to send an interim update for " + this.a);
}
public void h(@Nullable Bundle bundle) {
if (this.c || this.d) {
throw new IllegalStateException("sendError() called when either sendResult() or sendError() had already been called for: " + this.a);
}
this.d = true;
e(bundle);
}
public void i(@Nullable Bundle bundle) {
if (this.c || this.d) {
throw new IllegalStateException("sendProgressUpdate() called when either sendResult() or sendError() had already been called for: " + this.a);
}
a(bundle);
f(bundle);
}
public void j(@Nullable T t) {
if (this.c || this.d) {
throw new IllegalStateException("sendResult() called when either sendResult() or sendError() had already been called for: " + this.a);
}
this.c = true;
g(t);
}
public void k(int i) {
this.e = i;
}
public void g(@Nullable T t) {
}
}
public void s(@Nullable String str) {
}
public void r(@Nullable String str, @Nullable Bundle bundle) {
}
@Override
public void dump(FileDescriptor fileDescriptor, PrintWriter printWriter, String[] strArr) {
}
}