Initial version -- added millennium read funcionality
This commit is contained in:
+40
@@ -0,0 +1,40 @@
|
||||
package com.google.android.gms.auth.api.signin.internal;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptionsExtension;
|
||||
import com.google.android.gms.common.internal.safeparcel.AbstractSafeParcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelWriter;
|
||||
|
||||
/* JADX INFO: compiled from: com.google.android.gms:play-services-base@@18.4.0 */
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class GoogleSignInOptionsExtensionParcelable extends AbstractSafeParcelable {
|
||||
public static final Parcelable.Creator<GoogleSignInOptionsExtensionParcelable> CREATOR = new zaa();
|
||||
final int zaa;
|
||||
private int zab;
|
||||
private Bundle zac;
|
||||
|
||||
GoogleSignInOptionsExtensionParcelable(int i, int i2, Bundle bundle) {
|
||||
this.zaa = i;
|
||||
this.zab = i2;
|
||||
this.zac = bundle;
|
||||
}
|
||||
|
||||
public int getType() {
|
||||
return this.zab;
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable
|
||||
public final void writeToParcel(Parcel parcel, int i) {
|
||||
int iBeginObjectHeader = SafeParcelWriter.beginObjectHeader(parcel);
|
||||
SafeParcelWriter.writeInt(parcel, 1, this.zaa);
|
||||
SafeParcelWriter.writeInt(parcel, 2, getType());
|
||||
SafeParcelWriter.writeBundle(parcel, 3, this.zac, false);
|
||||
SafeParcelWriter.finishObjectHeader(parcel, iBeginObjectHeader);
|
||||
}
|
||||
|
||||
public GoogleSignInOptionsExtensionParcelable(GoogleSignInOptionsExtension googleSignInOptionsExtension) {
|
||||
this(1, googleSignInOptionsExtension.getExtensionType(), googleSignInOptionsExtension.toBundle());
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.google.android.gms.auth.api.signin.internal;
|
||||
|
||||
/* JADX INFO: compiled from: com.google.android.gms:play-services-base@@18.4.0 */
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class HashAccumulator {
|
||||
private int zaa = 1;
|
||||
|
||||
public HashAccumulator addObject(Object obj) {
|
||||
this.zaa = (this.zaa * 31) + (obj == null ? 0 : obj.hashCode());
|
||||
return this;
|
||||
}
|
||||
|
||||
public int hash() {
|
||||
return this.zaa;
|
||||
}
|
||||
|
||||
public final HashAccumulator zaa(boolean z) {
|
||||
this.zaa = (this.zaa * 31) + (z ? 1 : 0);
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,132 @@
|
||||
package com.google.android.gms.auth.api.signin.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.text.TextUtils;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInAccount;
|
||||
import com.google.android.gms.auth.api.signin.GoogleSignInOptions;
|
||||
import com.google.android.gms.common.internal.Preconditions;
|
||||
import java.util.concurrent.locks.Lock;
|
||||
import java.util.concurrent.locks.ReentrantLock;
|
||||
import org.json.JSONException;
|
||||
|
||||
/* JADX INFO: compiled from: com.google.android.gms:play-services-base@@18.4.0 */
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public class Storage {
|
||||
private static final Lock zaa = new ReentrantLock();
|
||||
private static Storage zab;
|
||||
private final Lock zac = new ReentrantLock();
|
||||
private final SharedPreferences zad;
|
||||
|
||||
Storage(Context context) {
|
||||
this.zad = context.getSharedPreferences("com.google.android.gms.signin", 0);
|
||||
}
|
||||
|
||||
public static Storage getInstance(Context context) {
|
||||
Preconditions.checkNotNull(context);
|
||||
Lock lock = zaa;
|
||||
lock.lock();
|
||||
try {
|
||||
if (zab == null) {
|
||||
zab = new Storage(context.getApplicationContext());
|
||||
}
|
||||
Storage storage = zab;
|
||||
lock.unlock();
|
||||
return storage;
|
||||
} catch (Throwable th) {
|
||||
zaa.unlock();
|
||||
throw th;
|
||||
}
|
||||
}
|
||||
|
||||
private static final String zae(String str, String str2) {
|
||||
return str + ":" + str2;
|
||||
}
|
||||
|
||||
public void clear() {
|
||||
this.zac.lock();
|
||||
try {
|
||||
this.zad.edit().clear().apply();
|
||||
} finally {
|
||||
this.zac.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public GoogleSignInAccount getSavedDefaultGoogleSignInAccount() {
|
||||
String strZaa;
|
||||
String strZaa2 = zaa("defaultGoogleSignInAccount");
|
||||
if (TextUtils.isEmpty(strZaa2) || (strZaa = zaa(zae("googleSignInAccount", strZaa2))) == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return GoogleSignInAccount.zab(strZaa);
|
||||
} catch (JSONException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public GoogleSignInOptions getSavedDefaultGoogleSignInOptions() {
|
||||
String strZaa;
|
||||
String strZaa2 = zaa("defaultGoogleSignInAccount");
|
||||
if (TextUtils.isEmpty(strZaa2) || (strZaa = zaa(zae("googleSignInOptions", strZaa2))) == null) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
return GoogleSignInOptions.zab(strZaa);
|
||||
} catch (JSONException unused) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getSavedRefreshToken() {
|
||||
return zaa("refreshToken");
|
||||
}
|
||||
|
||||
public void saveDefaultGoogleSignInAccount(GoogleSignInAccount googleSignInAccount, GoogleSignInOptions googleSignInOptions) {
|
||||
Preconditions.checkNotNull(googleSignInAccount);
|
||||
Preconditions.checkNotNull(googleSignInOptions);
|
||||
zad("defaultGoogleSignInAccount", googleSignInAccount.zac());
|
||||
Preconditions.checkNotNull(googleSignInAccount);
|
||||
Preconditions.checkNotNull(googleSignInOptions);
|
||||
String strZac = googleSignInAccount.zac();
|
||||
zad(zae("googleSignInAccount", strZac), googleSignInAccount.zad());
|
||||
zad(zae("googleSignInOptions", strZac), googleSignInOptions.zaf());
|
||||
}
|
||||
|
||||
protected final String zaa(String str) {
|
||||
this.zac.lock();
|
||||
try {
|
||||
return this.zad.getString(str, null);
|
||||
} finally {
|
||||
this.zac.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
protected final void zab(String str) {
|
||||
this.zac.lock();
|
||||
try {
|
||||
this.zad.edit().remove(str).apply();
|
||||
} finally {
|
||||
this.zac.unlock();
|
||||
}
|
||||
}
|
||||
|
||||
public final void zac() {
|
||||
String strZaa = zaa("defaultGoogleSignInAccount");
|
||||
zab("defaultGoogleSignInAccount");
|
||||
if (TextUtils.isEmpty(strZaa)) {
|
||||
return;
|
||||
}
|
||||
zab(zae("googleSignInAccount", strZaa));
|
||||
zab(zae("googleSignInOptions", strZaa));
|
||||
}
|
||||
|
||||
protected final void zad(String str, String str2) {
|
||||
this.zac.lock();
|
||||
try {
|
||||
this.zad.edit().putString(str, str2).apply();
|
||||
} finally {
|
||||
this.zac.unlock();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.google.android.gms.auth.api.signin.internal;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import com.google.android.gms.common.internal.safeparcel.SafeParcelReader;
|
||||
|
||||
/* JADX INFO: compiled from: com.google.android.gms:play-services-base@@18.4.0 */
|
||||
/* JADX INFO: loaded from: classes2.dex */
|
||||
public final class zaa implements Parcelable.Creator {
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* bridge */ /* synthetic */ Object createFromParcel(Parcel parcel) {
|
||||
int iValidateObjectHeader = SafeParcelReader.validateObjectHeader(parcel);
|
||||
Bundle bundleCreateBundle = null;
|
||||
int i = 0;
|
||||
int i2 = 0;
|
||||
while (parcel.dataPosition() < iValidateObjectHeader) {
|
||||
int header = SafeParcelReader.readHeader(parcel);
|
||||
int fieldId = SafeParcelReader.getFieldId(header);
|
||||
if (fieldId == 1) {
|
||||
i = SafeParcelReader.readInt(parcel, header);
|
||||
} else if (fieldId == 2) {
|
||||
i2 = SafeParcelReader.readInt(parcel, header);
|
||||
} else if (fieldId != 3) {
|
||||
SafeParcelReader.skipUnknownField(parcel, header);
|
||||
} else {
|
||||
bundleCreateBundle = SafeParcelReader.createBundle(parcel, header);
|
||||
}
|
||||
}
|
||||
SafeParcelReader.ensureAtEnd(parcel, iValidateObjectHeader);
|
||||
return new GoogleSignInOptionsExtensionParcelable(i, i2, bundleCreateBundle);
|
||||
}
|
||||
|
||||
@Override // android.os.Parcelable.Creator
|
||||
public final /* synthetic */ Object[] newArray(int i) {
|
||||
return new GoogleSignInOptionsExtensionParcelable[i];
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user