Skip to content

Fixes for multi-process access #1042

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 8 commits into from
Dec 10, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 21 additions & 9 deletions firebase-installations/api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,13 @@ package com.google.firebase.installations {
}

public enum FirebaseInstallationsException.Status {
enum_constant public static final com.google.firebase.installations.FirebaseInstallationsException.Status AUTHENTICATION_ERROR;
enum_constant public static final com.google.firebase.installations.FirebaseInstallationsException.Status CLIENT_ERROR;
enum_constant public static final com.google.firebase.installations.FirebaseInstallationsException.Status SDK_INTERNAL_ERROR;
enum_constant public static final com.google.firebase.installations.FirebaseInstallationsException.Status BAD_CONFIG;
enum_constant public static final com.google.firebase.installations.FirebaseInstallationsException.Status OK;
}

public class RandomFidGenerator {
ctor public RandomFidGenerator();
method @NonNull public String createRandomFid();
}

}
Expand All @@ -33,12 +37,13 @@ package com.google.firebase.installations.local {

public class PersistedInstallation {
ctor public PersistedInstallation(@NonNull FirebaseApp);
method @NonNull public boolean clear();
method @NonNull public boolean insertOrUpdatePersistedInstallationEntry(@NonNull com.google.firebase.installations.local.PersistedInstallationEntry);
method public void clearForTesting();
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry insertOrUpdatePersistedInstallationEntry(@NonNull com.google.firebase.installations.local.PersistedInstallationEntry);
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry readPersistedInstallationEntryValue();
}

public enum PersistedInstallation.RegistrationStatus {
enum_constant public static final com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus ATTEMPT_MIGRATION;
enum_constant public static final com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus NOT_GENERATED;
enum_constant public static final com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus REGISTERED;
enum_constant public static final com.google.firebase.installations.local.PersistedInstallation.RegistrationStatus REGISTER_ERROR;
Expand All @@ -59,7 +64,15 @@ package com.google.firebase.installations.local {
method public boolean isNotGenerated();
method public boolean isRegistered();
method public boolean isUnregistered();
method public boolean shouldAttemptMigration();
method @NonNull public abstract com.google.firebase.installations.local.PersistedInstallationEntry.Builder toBuilder();
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withAuthToken(@NonNull String, long, long);
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withClearedAuthToken();
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withFisError(@NonNull String);
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withNoGeneratedFid();
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withRegisteredFid(@NonNull String, @NonNull String, long, @Nullable String, long);
method @NonNull public com.google.firebase.installations.local.PersistedInstallationEntry withUnregisteredFid(@NonNull String);
field @NonNull public static com.google.firebase.installations.local.PersistedInstallationEntry INSTANCE;
}

public abstract static class PersistedInstallationEntry.Builder {
Expand Down Expand Up @@ -107,8 +120,8 @@ package com.google.firebase.installations.remote {
}

public enum InstallationResponse.ResponseCode {
enum_constant public static final com.google.firebase.installations.remote.InstallationResponse.ResponseCode BAD_CONFIG;
enum_constant public static final com.google.firebase.installations.remote.InstallationResponse.ResponseCode OK;
enum_constant public static final com.google.firebase.installations.remote.InstallationResponse.ResponseCode SERVER_ERROR;
}

public abstract class TokenResult {
Expand All @@ -117,7 +130,6 @@ package com.google.firebase.installations.remote {
method @Nullable public abstract com.google.firebase.installations.remote.TokenResult.ResponseCode getResponseCode();
method @Nullable public abstract String getToken();
method @NonNull public abstract long getTokenExpirationTimestamp();
method public boolean isSuccessful();
method @NonNull public abstract com.google.firebase.installations.remote.TokenResult.Builder toBuilder();
}

Expand All @@ -130,9 +142,9 @@ package com.google.firebase.installations.remote {
}

public enum TokenResult.ResponseCode {
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode FID_ERROR;
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode AUTH_ERROR;
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode BAD_CONFIG;
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode OK;
enum_constant public static final com.google.firebase.installations.remote.TokenResult.ResponseCode REFRESH_TOKEN_ERROR;
}

}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
// Copyright 2019 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package com.google.firebase.installations;

import java.util.Calendar;

public class FakeCalendar extends Calendar {
private long timeInMillis;

public FakeCalendar() {
timeInMillis = 5000000;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

epochInMillis?

Maybe consider passing the fake current time in via the constructor?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added the start time as a constructor param.

I think "timeInMillis" is more accurate, or timeSinceEpochInMillis.

}

public long getTimeInMillis() {
return timeInMillis;
}

public void setTimeInMillis(long timeInMillis) {
this.timeInMillis = timeInMillis;
}

public void advanceTimeBySeconds(long deltaSeconds) {
timeInMillis += (deltaSeconds * 1000L);
}

@Override
protected void computeTime() {}

@Override
protected void computeFields() {}

@Override
public void add(int i, int i1) {}

@Override
public void roll(int i, boolean b) {}

@Override
public int getMinimum(int i) {
return 0;
}

@Override
public int getMaximum(int i) {
return 0;
}

@Override
public int getGreatestMinimum(int i) {
return 0;
}

@Override
public int getLeastMaximum(int i) {
return 0;
}
}
Loading