package androidx.lifecycle; /* loaded from: classes.dex */ public class ViewModelProvider { private final Factory a; private final ViewModelStore b; public interface Factory { T a(Class cls); } public ViewModelProvider(ViewModelStore viewModelStore, Factory factory) { this.a = factory; this.b = viewModelStore; } public T a(Class cls) { String canonicalName = cls.getCanonicalName(); if (canonicalName == null) { throw new IllegalArgumentException("Local and anonymous classes can not be ViewModels"); } return (T) a("androidx.lifecycle.ViewModelProvider.DefaultKey:" + canonicalName, cls); } public T a(String str, Class cls) { T t = (T) this.b.a(str); if (cls.isInstance(t)) { return t; } T t2 = (T) this.a.a(cls); this.b.a(str, t2); return t2; } }