mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-12-24 03:35:50 +01:00
commit
f78d71a895
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
3
gradle/wrapper/gradle-wrapper.properties
vendored
3
gradle/wrapper/gradle-wrapper.properties
vendored
@ -1,6 +1,5 @@
|
||||
#Tue Jul 21 13:31:11 GET 2020
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.5.1-all.zip
|
||||
|
149
gradlew
vendored
149
gradlew
vendored
@ -1,4 +1,20 @@
|
||||
#!/usr/bin/env bash
|
||||
#!/usr/bin/env sh
|
||||
|
||||
#
|
||||
# Copyright 2015 the original author or authors.
|
||||
#
|
||||
# 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
|
||||
#
|
||||
# https://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.
|
||||
#
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
@ -6,47 +22,6 @@
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn ( ) {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die ( ) {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
esac
|
||||
|
||||
# For Cygwin, ensure paths are in UNIX format before anything is touched.
|
||||
if $cygwin ; then
|
||||
[ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"`
|
||||
fi
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
@ -61,12 +36,53 @@ while [ -h "$PRG" ] ; do
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >&-
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >&-
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
@ -90,7 +106,7 @@ location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
@ -110,10 +126,12 @@ if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
# For Cygwin or MSYS, switch paths to Windows format before running java
|
||||
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
@ -138,27 +156,30 @@ if $cygwin ; then
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
i=`expr $i + 1`
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
0) set -- ;;
|
||||
1) set -- "$args0" ;;
|
||||
2) set -- "$args0" "$args1" ;;
|
||||
3) set -- "$args0" "$args1" "$args2" ;;
|
||||
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules
|
||||
function splitJvmOpts() {
|
||||
JVM_OPTS=("$@")
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS
|
||||
JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME"
|
||||
APP_ARGS=`save "$@"`
|
||||
|
||||
exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@"
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
|
104
gradlew.bat
vendored
Normal file
104
gradlew.bat
vendored
Normal file
@ -0,0 +1,104 @@
|
||||
@rem
|
||||
@rem Copyright 2015 the original author or authors.
|
||||
@rem
|
||||
@rem Licensed under the Apache License, Version 2.0 (the "License");
|
||||
@rem you may not use this file except in compliance with the License.
|
||||
@rem You may obtain a copy of the License at
|
||||
@rem
|
||||
@rem https://www.apache.org/licenses/LICENSE-2.0
|
||||
@rem
|
||||
@rem Unless required by applicable law or agreed to in writing, software
|
||||
@rem distributed under the License is distributed on an "AS IS" BASIS,
|
||||
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
@rem See the License for the specific language governing permissions and
|
||||
@rem limitations under the License.
|
||||
@rem
|
||||
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
|
||||
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
@ -19,5 +19,5 @@ package com.google.android.gms.auth;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class AccountChangeEvent extends AutoSafeParcelable {
|
||||
public static Creator<AccountChangeEvent> CREATOR = new AutoCreator<AccountChangeEvent>(AccountChangeEvent.class);
|
||||
public static Creator<AccountChangeEvent> CREATOR = new AutoCreator<>(AccountChangeEvent.class);
|
||||
}
|
||||
|
@ -27,6 +27,6 @@ public class AccountChangeEventsRequest extends AutoSafeParcelable {
|
||||
@SafeParceled(3)
|
||||
private String s;
|
||||
|
||||
public static Creator<AccountChangeEventsRequest> CREATOR = new AutoCreator<AccountChangeEventsRequest>(AccountChangeEventsRequest.class);
|
||||
public static Creator<AccountChangeEventsRequest> CREATOR = new AutoCreator<>(AccountChangeEventsRequest.class);
|
||||
|
||||
}
|
||||
|
@ -29,8 +29,8 @@ public class AccountChangeEventsResponse extends AutoSafeParcelable {
|
||||
private List<AccountChangeEvent> events;
|
||||
|
||||
public AccountChangeEventsResponse() {
|
||||
events = new ArrayList<AccountChangeEvent>();
|
||||
events = new ArrayList<>();
|
||||
}
|
||||
|
||||
public static Creator<AccountChangeEventsResponse> CREATOR = new AutoCreator<AccountChangeEventsResponse>(AccountChangeEventsResponse.class);
|
||||
public static Creator<AccountChangeEventsResponse> CREATOR = new AutoCreator<>(AccountChangeEventsResponse.class);
|
||||
}
|
||||
|
@ -60,5 +60,5 @@ public class TokenData extends AutoSafeParcelable {
|
||||
this.scopes = null;
|
||||
}
|
||||
|
||||
public static final Creator<TokenData> CREATOR = new AutoCreator<TokenData>(TokenData.class);
|
||||
public static final Creator<TokenData> CREATOR = new AutoCreator<>(TokenData.class);
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import org.microg.safeparcel.SafeParceled;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
@PublicApi
|
||||
public class Credential extends AutoSafeParcelable {
|
||||
@ -139,19 +140,19 @@ public class Credential extends AutoSafeParcelable {
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || !(o instanceof Credential)) return false;
|
||||
if (!(o instanceof Credential)) return false;
|
||||
|
||||
Credential that = (Credential) o;
|
||||
|
||||
if (id != null ? !id.equals(that.id) : that.id != null) return false;
|
||||
if (name != null ? !name.equals(that.name) : that.name != null) return false;
|
||||
if (profilePictureUri != null ? !profilePictureUri.equals(that.profilePictureUri) : that.profilePictureUri != null)
|
||||
if (!Objects.equals(id, that.id)) return false;
|
||||
if (!Objects.equals(name, that.name)) return false;
|
||||
if (!Objects.equals(profilePictureUri, that.profilePictureUri))
|
||||
return false;
|
||||
if (password != null ? !password.equals(that.password) : that.password != null)
|
||||
if (!Objects.equals(password, that.password))
|
||||
return false;
|
||||
if (accountType != null ? !accountType.equals(that.accountType) : that.accountType != null)
|
||||
if (!Objects.equals(accountType, that.accountType))
|
||||
return false;
|
||||
return generatedPassword != null ? generatedPassword.equals(that.generatedPassword) : that.generatedPassword == null;
|
||||
return Objects.equals(generatedPassword, that.generatedPassword);
|
||||
|
||||
}
|
||||
|
||||
@ -245,5 +246,5 @@ public class Credential extends AutoSafeParcelable {
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator<Credential> CREATOR = new AutoCreator<Credential>(Credential.class);
|
||||
public static final Creator<Credential> CREATOR = new AutoCreator<>(Credential.class);
|
||||
}
|
||||
|
@ -54,7 +54,7 @@ public class CredentialPickerConfig extends AutoSafeParcelable {
|
||||
return showCancelButton;
|
||||
}
|
||||
|
||||
public class Builder {
|
||||
public static class Builder {
|
||||
private boolean showAddAccountButton;
|
||||
private boolean showCancelButton;
|
||||
private boolean forNewAccount;
|
||||
@ -88,5 +88,5 @@ public class CredentialPickerConfig extends AutoSafeParcelable {
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator<CredentialPickerConfig> CREATOR = new AutoCreator<CredentialPickerConfig>(CredentialPickerConfig.class);
|
||||
public static final Creator<CredentialPickerConfig> CREATOR = new AutoCreator<>(CredentialPickerConfig.class);
|
||||
}
|
||||
|
@ -71,5 +71,5 @@ public class CredentialRequest extends AutoSafeParcelable {
|
||||
return passwordLoginSupported;
|
||||
}
|
||||
|
||||
public static final Creator<CredentialRequest> CREATOR = new AutoCreator<CredentialRequest>(CredentialRequest.class);
|
||||
public static final Creator<CredentialRequest> CREATOR = new AutoCreator<>(CredentialRequest.class);
|
||||
}
|
||||
|
@ -54,5 +54,5 @@ public class IdToken extends AutoSafeParcelable {
|
||||
return id;
|
||||
}
|
||||
|
||||
public static final Creator<IdToken> CREATOR = new AutoCreator<IdToken>(IdToken.class);
|
||||
public static final Creator<IdToken> CREATOR = new AutoCreator<>(IdToken.class);
|
||||
}
|
||||
|
@ -19,5 +19,5 @@ package com.google.android.gms.auth.api.credentials.internal;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class DeleteRequest extends AutoSafeParcelable {
|
||||
public static final Creator<DeleteRequest> CREATOR = new AutoCreator<DeleteRequest>(DeleteRequest.class);
|
||||
public static final Creator<DeleteRequest> CREATOR = new AutoCreator<>(DeleteRequest.class);
|
||||
}
|
||||
|
@ -19,5 +19,5 @@ package com.google.android.gms.auth.api.credentials.internal;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class GeneratePasswordRequest extends AutoSafeParcelable {
|
||||
public static final Creator<GeneratePasswordRequest> CREATOR = new AutoCreator<GeneratePasswordRequest>(GeneratePasswordRequest.class);
|
||||
public static final Creator<GeneratePasswordRequest> CREATOR = new AutoCreator<>(GeneratePasswordRequest.class);
|
||||
}
|
||||
|
@ -19,5 +19,5 @@ package com.google.android.gms.auth.api.credentials.internal;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class SaveRequest extends AutoSafeParcelable {
|
||||
public static final Creator<SaveRequest> CREATOR = new AutoCreator<SaveRequest>(SaveRequest.class);
|
||||
public static final Creator<SaveRequest> CREATOR = new AutoCreator<>(SaveRequest.class);
|
||||
}
|
||||
|
@ -42,5 +42,5 @@ public class AccountRecoveryGuidanceRequest extends AutoSafeParcelable {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public static final Creator<AccountRecoveryGuidanceRequest> CREATOR = new AutoCreator<AccountRecoveryGuidanceRequest>(AccountRecoveryGuidanceRequest.class);
|
||||
public static final Creator<AccountRecoveryGuidanceRequest> CREATOR = new AutoCreator<>(AccountRecoveryGuidanceRequest.class);
|
||||
}
|
||||
|
@ -42,5 +42,5 @@ public class AccountRemovalRequest extends AutoSafeParcelable {
|
||||
this.account = account;
|
||||
}
|
||||
|
||||
public static final Creator<AccountRemovalRequest> CREATOR = new AutoCreator<AccountRemovalRequest>(AccountRemovalRequest.class);
|
||||
public static final Creator<AccountRemovalRequest> CREATOR = new AutoCreator<>(AccountRemovalRequest.class);
|
||||
}
|
||||
|
@ -30,5 +30,5 @@ public class ConfirmCredentialsRequest extends AutoSafeParcelable {
|
||||
@SafeParceled(3)
|
||||
public CaptchaSolution captchaSolution;
|
||||
|
||||
public static final Creator<ConfirmCredentialsRequest> CREATOR = new AutoCreator<ConfirmCredentialsRequest>(ConfirmCredentialsRequest.class);
|
||||
public static final Creator<ConfirmCredentialsRequest> CREATOR = new AutoCreator<>(ConfirmCredentialsRequest.class);
|
||||
}
|
||||
|
@ -40,5 +40,5 @@ public class TokenRequest extends AutoSafeParcelable{
|
||||
return new Account(accountName, accountType);
|
||||
}
|
||||
|
||||
public static final Creator<TokenRequest> CREATOR = new AutoCreator<TokenRequest>(TokenRequest.class);
|
||||
public static final Creator<TokenRequest> CREATOR = new AutoCreator<>(TokenRequest.class);
|
||||
}
|
||||
|
@ -39,5 +39,5 @@ public class ConfirmCredentialsWorkflowRequest extends AutoSafeParcelable {
|
||||
@SafeParceled(6)
|
||||
public AccountAuthenticatorResponse accountAuthenticatorResponse;
|
||||
|
||||
public static final Creator<ConfirmCredentialsWorkflowRequest> CREATOR = new AutoCreator<ConfirmCredentialsWorkflowRequest>(ConfirmCredentialsWorkflowRequest.class);
|
||||
public static final Creator<ConfirmCredentialsWorkflowRequest> CREATOR = new AutoCreator<>(ConfirmCredentialsWorkflowRequest.class);
|
||||
}
|
||||
|
@ -34,5 +34,5 @@ public class AccountCredentials extends AutoSafeParcelable {
|
||||
return new Account(accountName, accountType);
|
||||
}
|
||||
|
||||
public static final Creator<AccountCredentials> CREATOR = new AutoCreator<AccountCredentials>(AccountCredentials.class);
|
||||
public static final Creator<AccountCredentials> CREATOR = new AutoCreator<>(AccountCredentials.class);
|
||||
}
|
||||
|
@ -31,5 +31,5 @@ public class AppDescription extends AutoSafeParcelable {
|
||||
@SafeParceled(5)
|
||||
public String callingPkg;
|
||||
|
||||
public static final Creator<AppDescription> CREATOR = new AutoCreator<AppDescription>(AppDescription.class);
|
||||
public static final Creator<AppDescription> CREATOR = new AutoCreator<>(AppDescription.class);
|
||||
}
|
||||
|
@ -25,5 +25,5 @@ public class CaptchaSolution extends AutoSafeParcelable {
|
||||
@SafeParceled(1)
|
||||
private int versionCode = 1;
|
||||
|
||||
public static final Creator<CaptchaSolution> CREATOR = new AutoCreator<CaptchaSolution>(CaptchaSolution.class);
|
||||
public static final Creator<CaptchaSolution> CREATOR = new AutoCreator<>(CaptchaSolution.class);
|
||||
}
|
||||
|
@ -25,8 +25,8 @@ import org.microg.safeparcel.SafeParceled;
|
||||
|
||||
import java.nio.ByteBuffer;
|
||||
import java.nio.CharBuffer;
|
||||
import java.nio.charset.Charset;
|
||||
import java.nio.charset.CharsetDecoder;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.Arrays;
|
||||
|
||||
public class LogEventParcelable extends AutoSafeParcelable {
|
||||
@ -92,7 +92,7 @@ public class LogEventParcelable extends AutoSafeParcelable {
|
||||
private String getBytesAsString() {
|
||||
if (bytes == null) return "null";
|
||||
try {
|
||||
CharsetDecoder d = Charset.forName("US-ASCII").newDecoder();
|
||||
CharsetDecoder d = StandardCharsets.US_ASCII.newDecoder();
|
||||
CharBuffer r = d.decode(ByteBuffer.wrap(bytes));
|
||||
return r.toString();
|
||||
} catch (Exception e) {
|
||||
@ -100,5 +100,5 @@ public class LogEventParcelable extends AutoSafeParcelable {
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator<LogEventParcelable> CREATOR = new AutoCreator<LogEventParcelable>(LogEventParcelable.class);
|
||||
public static final Creator<LogEventParcelable> CREATOR = new AutoCreator<>(LogEventParcelable.class);
|
||||
}
|
||||
|
@ -71,5 +71,5 @@ public class GoogleCertificatesQuery extends AutoSafeParcelable {
|
||||
return certData;
|
||||
}
|
||||
|
||||
public static final Creator<GoogleCertificatesQuery> CREATOR = new AutoCreator<GoogleCertificatesQuery>(GoogleCertificatesQuery.class);
|
||||
public static final Creator<GoogleCertificatesQuery> CREATOR = new AutoCreator<>(GoogleCertificatesQuery.class);
|
||||
}
|
||||
|
@ -20,5 +20,5 @@ import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class FavaDiagnosticsEntity extends AutoSafeParcelable {
|
||||
|
||||
public static final Creator<FavaDiagnosticsEntity> CREATOR = new AutoCreator<FavaDiagnosticsEntity>(FavaDiagnosticsEntity.class);
|
||||
public static final Creator<FavaDiagnosticsEntity> CREATOR = new AutoCreator<>(FavaDiagnosticsEntity.class);
|
||||
}
|
||||
|
@ -32,5 +32,5 @@ public class ParcelableLoadImageOptions extends AutoSafeParcelable {
|
||||
@SafeParceled(3)
|
||||
public boolean useLargePictureForCp2Images;
|
||||
|
||||
public static final Creator<ParcelableLoadImageOptions> CREATOR = new AutoCreator<ParcelableLoadImageOptions>(ParcelableLoadImageOptions.class);
|
||||
public static final Creator<ParcelableLoadImageOptions> CREATOR = new AutoCreator<>(ParcelableLoadImageOptions.class);
|
||||
}
|
||||
|
@ -36,5 +36,5 @@ public class AccountMetadata extends AutoSafeParcelable {
|
||||
@SafeParceled(5)
|
||||
public boolean hasFeature4 = true;
|
||||
|
||||
public static Creator<AccountMetadata> CREATOR = new AutoCreator<AccountMetadata>(AccountMetadata.class);
|
||||
public static Creator<AccountMetadata> CREATOR = new AutoCreator<>(AccountMetadata.class);
|
||||
}
|
||||
|
@ -30,5 +30,5 @@ public class AvatarReference extends AutoSafeParcelable {
|
||||
@SafeParceled(2)
|
||||
public String location;
|
||||
|
||||
public static final Creator<AvatarReference> CREATOR = new AutoCreator<AvatarReference>(AvatarReference.class);
|
||||
public static final Creator<AvatarReference> CREATOR = new AutoCreator<>(AvatarReference.class);
|
||||
}
|
||||
|
@ -50,5 +50,5 @@ public class LogEvent extends AutoSafeParcelable {
|
||||
'}';
|
||||
}
|
||||
|
||||
public static Creator<LogEvent> CREATOR = new AutoCreator<LogEvent>(LogEvent.class);
|
||||
public static Creator<LogEvent> CREATOR = new AutoCreator<>(LogEvent.class);
|
||||
}
|
||||
|
@ -83,19 +83,18 @@ public class PlayLoggerContext extends AutoSafeParcelable {
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
final StringBuilder sb = new StringBuilder("PlayLoggerContext[").append(versionCode);
|
||||
sb.append(", package=").append(packageName);
|
||||
sb.append(", packageVersionCode=").append(packageVersionCode);
|
||||
sb.append(", logSource=").append(logSource);
|
||||
sb.append(", uploadAccount=").append(uploadAccount);
|
||||
sb.append(", loggingId=").append(loggingId);
|
||||
sb.append(", logAndroidId=").append(logAndroidId);
|
||||
sb.append(", logSourceName=").append(logSourceName);
|
||||
sb.append(", isAnonymous=").append(isAnonymous);
|
||||
sb.append(", qosTier=").append(qosTier);
|
||||
sb.append(']');
|
||||
return sb.toString();
|
||||
return "PlayLoggerContext[" + versionCode +
|
||||
", package=" + packageName +
|
||||
", packageVersionCode=" + packageVersionCode +
|
||||
", logSource=" + logSource +
|
||||
", uploadAccount=" + uploadAccount +
|
||||
", loggingId=" + loggingId +
|
||||
", logAndroidId=" + logAndroidId +
|
||||
", logSourceName=" + logSourceName +
|
||||
", isAnonymous=" + isAnonymous +
|
||||
", qosTier=" + qosTier +
|
||||
']';
|
||||
}
|
||||
|
||||
public static Creator<PlayLoggerContext> CREATOR = new AutoCreator<PlayLoggerContext>(PlayLoggerContext.class);
|
||||
public static Creator<PlayLoggerContext> CREATOR = new AutoCreator<>(PlayLoggerContext.class);
|
||||
}
|
||||
|
@ -8,5 +8,5 @@ package com.google.android.gms.auth.api.signin;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class GoogleSignInAccount extends AutoSafeParcelable {
|
||||
public static final Creator<GoogleSignInAccount> CREATOR = new AutoCreator<GoogleSignInAccount>(GoogleSignInAccount.class);
|
||||
public static final Creator<GoogleSignInAccount> CREATOR = new AutoCreator<>(GoogleSignInAccount.class);
|
||||
}
|
||||
|
@ -211,7 +211,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
|
||||
@SuppressWarnings("deprecation")
|
||||
private static CursorWindow[] createCursorWindows(Builder builder) {
|
||||
if (builder.columns.length == 0) return new CursorWindow[0];
|
||||
List<CursorWindow> windows = new ArrayList<CursorWindow>();
|
||||
List<CursorWindow> windows = new ArrayList<>();
|
||||
try {
|
||||
CursorWindow current = null;
|
||||
for (int rowIndex = 0; rowIndex < builder.rows.size(); rowIndex++) {
|
||||
@ -223,7 +223,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
|
||||
windows.add(current);
|
||||
if (!current.allocRow()) {
|
||||
windows.remove(current);
|
||||
return windows.toArray(new CursorWindow[windows.size()]);
|
||||
return windows.toArray(new CursorWindow[0]);
|
||||
}
|
||||
}
|
||||
for (int columnIndex = 0; columnIndex < builder.columns.length; columnIndex++) {
|
||||
@ -256,12 +256,12 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return windows.toArray(new CursorWindow[windows.size()]);
|
||||
return windows.toArray(new CursorWindow[0]);
|
||||
}
|
||||
|
||||
private static CursorWindow[] createCursorWindows(Cursor cursor) {
|
||||
if (cursor.getColumnCount() == 0) return new CursorWindow[0];
|
||||
List<CursorWindow> windows = new ArrayList<CursorWindow>();
|
||||
List<CursorWindow> windows = new ArrayList<>();
|
||||
CursorWindow current = null;
|
||||
int rowIndex = 0;
|
||||
while (cursor.moveToNext()) {
|
||||
@ -272,7 +272,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
|
||||
windows.add(current);
|
||||
if (!current.allocRow()) {
|
||||
windows.remove(current);
|
||||
return windows.toArray(new CursorWindow[windows.size()]);
|
||||
return windows.toArray(new CursorWindow[0]);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < cursor.getColumnCount(); i++) {
|
||||
@ -297,7 +297,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
|
||||
rowIndex++;
|
||||
}
|
||||
cursor.close();
|
||||
return windows.toArray(new CursorWindow[windows.size()]);
|
||||
return windows.toArray(new CursorWindow[0]);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -436,7 +436,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
|
||||
}
|
||||
|
||||
public void validateContents() {
|
||||
columnIndices = new HashMap<String, Integer>();
|
||||
columnIndices = new HashMap<>();
|
||||
for (int i = 0; i < columns.length; i++) {
|
||||
columnIndices.put(columns[i], i);
|
||||
}
|
||||
@ -455,9 +455,9 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
|
||||
|
||||
private Builder(String[] columns, String uniqueColumn) {
|
||||
this.columns = columns;
|
||||
this.rows = new ArrayList<Map<String, Object>>();
|
||||
this.rows = new ArrayList<>();
|
||||
this.uniqueColumn = uniqueColumn;
|
||||
this.uniqueIndizes = new HashMap<Object, Integer>();
|
||||
this.uniqueIndizes = new HashMap<>();
|
||||
}
|
||||
|
||||
/**
|
||||
@ -509,7 +509,7 @@ public class DataHolder extends AutoSafeParcelable implements Closeable {
|
||||
* @return {@link DataHolder.Builder} to continue construction.
|
||||
*/
|
||||
public Builder withRow(ContentValues values) {
|
||||
HashMap<String, Object> row = new HashMap<String, Object>();
|
||||
HashMap<String, Object> row = new HashMap<>();
|
||||
for (Map.Entry<String, Object> entry : values.valueSet()) {
|
||||
row.put(entry.getKey(), entry.getValue());
|
||||
}
|
||||
|
@ -24,7 +24,7 @@ import org.microg.safeparcel.AutoSafeParcelable;
|
||||
import org.microg.safeparcel.SafeParceled;
|
||||
|
||||
public class WebImage extends AutoSafeParcelable {
|
||||
public static final Creator<WebImage> CREATOR = new AutoCreator<WebImage>(WebImage.class);
|
||||
public static final Creator<WebImage> CREATOR = new AutoCreator<>(WebImage.class);
|
||||
|
||||
public WebImage () {
|
||||
this.uri = null;
|
||||
@ -59,6 +59,6 @@ public class WebImage extends AutoSafeParcelable {
|
||||
}
|
||||
|
||||
public String toString() {
|
||||
return String.format(Locale.getDefault(), "Image %dx%d %s", new Object[]{Integer.valueOf(width), Integer.valueOf(height), uri.toString()});
|
||||
return String.format(Locale.getDefault(), "Image %dx%d %s", width, height, uri.toString());
|
||||
}
|
||||
}
|
||||
|
@ -20,5 +20,5 @@ import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
@Deprecated
|
||||
public class AccountInfo extends AutoSafeParcelable {
|
||||
public static final Creator<AccountInfo> CREATOR = new AutoCreator<AccountInfo>(AccountInfo.class);
|
||||
public static final Creator<AccountInfo> CREATOR = new AutoCreator<>(AccountInfo.class);
|
||||
}
|
||||
|
@ -143,7 +143,7 @@ public interface GoogleApiClient {
|
||||
* @see #registerConnectionFailedListener(OnConnectionFailedListener)
|
||||
* @see #unregisterConnectionFailedListener(OnConnectionFailedListener)
|
||||
*/
|
||||
public boolean isConnectionFailedListenerRegistered(OnConnectionFailedListener listener);
|
||||
boolean isConnectionFailedListenerRegistered(OnConnectionFailedListener listener);
|
||||
|
||||
/**
|
||||
* Closes the current connection to Google Play services and creates a new connection.
|
||||
@ -198,7 +198,7 @@ public interface GoogleApiClient {
|
||||
* @param listener the listener where the results of the asynchronous {@link #connect()} call
|
||||
* are delivered.
|
||||
*/
|
||||
public void registerConnectionFailedListener(OnConnectionFailedListener listener);
|
||||
void registerConnectionFailedListener(OnConnectionFailedListener listener);
|
||||
|
||||
/**
|
||||
* Disconnects the client and stops automatic lifecycle management. Use this before creating a
|
||||
@ -241,10 +241,10 @@ public interface GoogleApiClient {
|
||||
@PublicApi
|
||||
class Builder {
|
||||
private final Context context;
|
||||
private final Map<Api, Api.ApiOptions> apis = new HashMap<Api, Api.ApiOptions>();
|
||||
private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<ConnectionCallbacks>();
|
||||
private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<OnConnectionFailedListener>();
|
||||
private final Set<String> scopes = new HashSet<String>();
|
||||
private final Map<Api, Api.ApiOptions> apis = new HashMap<>();
|
||||
private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<>();
|
||||
private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<>();
|
||||
private final Set<String> scopes = new HashSet<>();
|
||||
private String accountName;
|
||||
private int clientId = -1;
|
||||
private FragmentActivity fragmentActivity;
|
||||
|
@ -40,20 +40,20 @@ public interface PendingResult<R extends Result> {
|
||||
* Blocks until the task is completed. This is not allowed on the UI thread. The returned
|
||||
* result object can have an additional failure mode of INTERRUPTED.
|
||||
*/
|
||||
public R await();
|
||||
R await();
|
||||
|
||||
/**
|
||||
* Blocks until the task is completed or has timed out waiting for the result. This is not
|
||||
* allowed on the UI thread. The returned result object can have an additional failure mode
|
||||
* of either INTERRUPTED or TIMEOUT.
|
||||
*/
|
||||
public R await(long time, TimeUnit unit);
|
||||
R await(long time, TimeUnit unit);
|
||||
|
||||
public void cancel();
|
||||
void cancel();
|
||||
|
||||
public boolean isCanceled();
|
||||
boolean isCanceled();
|
||||
|
||||
public void setResultCallback(ResultCallback<R> callback, long time, TimeUnit unit);
|
||||
void setResultCallback(ResultCallback<R> callback, long time, TimeUnit unit);
|
||||
|
||||
public void setResultCallback(ResultCallback<R> callback);
|
||||
void setResultCallback(ResultCallback<R> callback);
|
||||
}
|
||||
|
@ -44,7 +44,7 @@ public class GmsConnector<C extends ApiClient, R extends Result> {
|
||||
}
|
||||
|
||||
public static <C extends ApiClient, R extends Result> PendingResult<R> call(GoogleApiClient client, Api api, GmsConnector.Callback<C, R> callback) {
|
||||
return new GmsConnector<C, R>(client, api, callback).connect();
|
||||
return new GmsConnector<>(client, api, callback).connect();
|
||||
}
|
||||
|
||||
public AbstractPendingResult<R> connect() {
|
||||
@ -52,7 +52,7 @@ public class GmsConnector<C extends ApiClient, R extends Result> {
|
||||
apiClient.incrementUsageCounter();
|
||||
apiClient.getApiConnection(api);
|
||||
Looper looper = apiClient.getLooper();
|
||||
final AbstractPendingResult<R> result = new AbstractPendingResult<R>(looper);
|
||||
final AbstractPendingResult<R> result = new AbstractPendingResult<>(looper);
|
||||
Message msg = new Message();
|
||||
msg.obj = result;
|
||||
new Handler(looper).sendMessage(msg);
|
||||
@ -78,12 +78,9 @@ public class GmsConnector<C extends ApiClient, R extends Result> {
|
||||
final AbstractPendingResult<R> result = (AbstractPendingResult<R>) msg.obj;
|
||||
try {
|
||||
C connection = (C) apiClient.getApiConnection(api);
|
||||
callback.onClientAvailable(connection, new GmsConnector.Callback.ResultProvider<R>() {
|
||||
@Override
|
||||
public void onResultAvailable(R realResult) {
|
||||
result.deliverResult(realResult);
|
||||
apiClient.decrementUsageCounter();
|
||||
}
|
||||
callback.onClientAvailable(connection, realResult -> {
|
||||
result.deliverResult(realResult);
|
||||
apiClient.decrementUsageCounter();
|
||||
});
|
||||
} catch (RemoteException ignored) {
|
||||
|
||||
|
@ -39,7 +39,7 @@ public class MultiConnectionKeeper {
|
||||
private static MultiConnectionKeeper INSTANCE;
|
||||
|
||||
private final Context context;
|
||||
private final Map<String, Connection> connections = new HashMap<String, Connection>();
|
||||
private final Map<String, Connection> connections = new HashMap<>();
|
||||
|
||||
public MultiConnectionKeeper(Context context) {
|
||||
this.context = context;
|
||||
@ -83,7 +83,7 @@ public class MultiConnectionKeeper {
|
||||
|
||||
public class Connection {
|
||||
private final String actionString;
|
||||
private final Set<ServiceConnection> connectionForwards = new HashSet<ServiceConnection>();
|
||||
private final Set<ServiceConnection> connectionForwards = new HashSet<>();
|
||||
private boolean bound = false;
|
||||
private boolean connected = false;
|
||||
private IBinder binder;
|
||||
|
@ -34,7 +34,7 @@ public class AbstractPendingResult<R extends Result> implements PendingResult<R>
|
||||
private ResultCallback<R> resultCallback;
|
||||
|
||||
public AbstractPendingResult(Looper looper) {
|
||||
handler = new ResultCallbackHandler<R>(looper);
|
||||
handler = new ResultCallbackHandler<>(looper);
|
||||
}
|
||||
|
||||
private R getResult() {
|
||||
|
@ -19,12 +19,10 @@ package org.microg.gms.common.api;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.common.ConnectionResult;
|
||||
import com.google.android.gms.common.api.Api;
|
||||
import com.google.android.gms.common.api.GoogleApiClient;
|
||||
@ -43,10 +41,10 @@ public class GoogleApiClientImpl implements GoogleApiClient {
|
||||
private final Context context;
|
||||
private final Looper looper;
|
||||
private final ApiClientSettings clientSettings;
|
||||
private final Map<Api, Api.ApiOptions> apis = new HashMap<Api, Api.ApiOptions>();
|
||||
private final Map<Api, ApiClient> apiConnections = new HashMap<Api, ApiClient>();
|
||||
private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<ConnectionCallbacks>();
|
||||
private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<OnConnectionFailedListener>();
|
||||
private final Map<Api, Api.ApiOptions> apis = new HashMap<>();
|
||||
private final Map<Api, ApiClient> apiConnections = new HashMap<>();
|
||||
private final Set<ConnectionCallbacks> connectionCallbacks = new HashSet<>();
|
||||
private final Set<OnConnectionFailedListener> connectionFailedListeners = new HashSet<>();
|
||||
private final int clientId;
|
||||
private final ConnectionCallbacks baseConnectionCallbacks = new ConnectionCallbacks() {
|
||||
@Override
|
||||
@ -65,16 +63,12 @@ public class GoogleApiClientImpl implements GoogleApiClient {
|
||||
}
|
||||
}
|
||||
};
|
||||
private final OnConnectionFailedListener baseConnectionFailedListener = new
|
||||
OnConnectionFailedListener() {
|
||||
@Override
|
||||
public void onConnectionFailed(ConnectionResult result) {
|
||||
Log.d(TAG, "OnConnectionFailedListener : onConnectionFailed()");
|
||||
for (OnConnectionFailedListener listener : connectionFailedListeners) {
|
||||
listener.onConnectionFailed(result);
|
||||
}
|
||||
}
|
||||
};
|
||||
private final OnConnectionFailedListener baseConnectionFailedListener = result -> {
|
||||
Log.d(TAG, "OnConnectionFailedListener : onConnectionFailed()");
|
||||
for (OnConnectionFailedListener listener : connectionFailedListeners) {
|
||||
listener.onConnectionFailed(result);
|
||||
}
|
||||
};
|
||||
private int usageCounter = 0;
|
||||
private boolean shouldDisconnect = false;
|
||||
|
||||
|
@ -17,6 +17,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Objects;
|
||||
|
||||
public class GoogleApiManager {
|
||||
private static GoogleApiManager instance;
|
||||
@ -52,7 +53,7 @@ public class GoogleApiManager {
|
||||
if (connected) {
|
||||
apiCall.execute(client, completionSource);
|
||||
} else {
|
||||
waitingApiCallMap.get(new ApiInstance(api)).add(new WaitingApiCall<R>((PendingGoogleApiCall<R, ApiClient>) apiCall, completionSource));
|
||||
waitingApiCallMap.get(new ApiInstance(api)).add(new WaitingApiCall<>((PendingGoogleApiCall<R, ApiClient>) apiCall, completionSource));
|
||||
if (!connecting) {
|
||||
client.connect();
|
||||
}
|
||||
@ -134,8 +135,8 @@ public class GoogleApiManager {
|
||||
|
||||
WaitingApiCall<?> that = (WaitingApiCall<?>) o;
|
||||
|
||||
if (apiCall != null ? !apiCall.equals(that.apiCall) : that.apiCall != null) return false;
|
||||
return completionSource != null ? completionSource.equals(that.completionSource) : that.completionSource == null;
|
||||
if (!Objects.equals(apiCall, that.apiCall)) return false;
|
||||
return Objects.equals(completionSource, that.completionSource);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -166,8 +167,8 @@ public class GoogleApiManager {
|
||||
|
||||
ApiInstance that = (ApiInstance) o;
|
||||
|
||||
if (apiClass != null ? !apiClass.equals(that.apiClass) : that.apiClass != null) return false;
|
||||
return apiOptions != null ? apiOptions.equals(that.apiOptions) : that.apiOptions == null;
|
||||
if (!Objects.equals(apiClass, that.apiClass)) return false;
|
||||
return Objects.equals(apiOptions, that.apiOptions);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -50,7 +50,7 @@ class ResultCallbackHandler<R extends Result> extends Handler {
|
||||
public void sendResultCallback(ResultCallback<R> callback, R result) {
|
||||
Message message = new Message();
|
||||
message.what = CALLBACK_ON_COMPLETE;
|
||||
message.obj = new OnCompleteObject<R>(callback, result);
|
||||
message.obj = new OnCompleteObject<>(callback, result);
|
||||
sendMessage(message);
|
||||
}
|
||||
|
||||
|
@ -23,5 +23,5 @@ import org.microg.gms.common.PublicApi;
|
||||
*/
|
||||
@PublicApi
|
||||
public interface Result {
|
||||
public Status getStatus();
|
||||
Status getStatus();
|
||||
}
|
||||
|
@ -29,5 +29,5 @@ public interface ResultCallback<R extends Result> {
|
||||
*
|
||||
* @param result The result from the API call. May not be null.
|
||||
*/
|
||||
public void onResult(R result);
|
||||
void onResult(R result);
|
||||
}
|
||||
|
@ -61,5 +61,5 @@ public class Scope extends AutoSafeParcelable {
|
||||
return scopeUri;
|
||||
}
|
||||
|
||||
public static final Creator<Scope> CREATOR = new AutoCreator<Scope>(Scope.class);
|
||||
public static final Creator<Scope> CREATOR = new AutoCreator<>(Scope.class);
|
||||
}
|
||||
|
@ -176,5 +176,5 @@ public final class Status extends AutoSafeParcelable implements Result {
|
||||
}
|
||||
}
|
||||
|
||||
public static final Creator<Status> CREATOR = new AutoCreator<Status>(Status.class);
|
||||
public static final Creator<Status> CREATOR = new AutoCreator<>(Status.class);
|
||||
}
|
||||
|
@ -79,5 +79,5 @@ public class GetServiceRequest extends AutoSafeParcelable {
|
||||
'}';
|
||||
}
|
||||
|
||||
public static Creator<GetServiceRequest> CREATOR = new AutoCreator<GetServiceRequest>(GetServiceRequest.class);
|
||||
public static Creator<GetServiceRequest> CREATOR = new AutoCreator<>(GetServiceRequest.class);
|
||||
}
|
||||
|
@ -19,5 +19,5 @@ package com.google.android.gms.common.internal;
|
||||
import org.microg.safeparcel.AutoSafeParcelable;
|
||||
|
||||
public class ValidateAccountRequest extends AutoSafeParcelable {
|
||||
public static Creator<ValidateAccountRequest> CREATOR = new AutoCreator<ValidateAccountRequest>(ValidateAccountRequest.class);
|
||||
public static Creator<ValidateAccountRequest> CREATOR = new AutoCreator<>(ValidateAccountRequest.class);
|
||||
}
|
||||
|
@ -72,6 +72,6 @@ public class ObjectWrapper<T> extends IObjectWrapper.Stub {
|
||||
}
|
||||
|
||||
public static <T> ObjectWrapper<T> wrap(T t) {
|
||||
return new ObjectWrapper<T>(t);
|
||||
return new ObjectWrapper<>(t);
|
||||
}
|
||||
}
|
||||
|
@ -81,5 +81,5 @@ public class ApplicationMetadata extends AutoSafeParcelable {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
public static final Creator<ApplicationMetadata> CREATOR = new AutoCreator<ApplicationMetadata>(ApplicationMetadata.class);
|
||||
public static final Creator<ApplicationMetadata> CREATOR = new AutoCreator<>(ApplicationMetadata.class);
|
||||
}
|
||||
|
@ -32,5 +32,5 @@ public class ApplicationStatus extends AutoSafeParcelable {
|
||||
@SafeParceled(2)
|
||||
private String applicationStatus;
|
||||
|
||||
public static final Creator<ApplicationStatus> CREATOR = new AutoCreator<ApplicationStatus>(ApplicationStatus.class);
|
||||
public static final Creator<ApplicationStatus> CREATOR = new AutoCreator<>(ApplicationStatus.class);
|
||||
}
|
||||
|
@ -27,7 +27,6 @@ import org.microg.safeparcel.AutoSafeParcelable;
|
||||
import org.microg.safeparcel.SafeParceled;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.Inet4Address;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
@ -47,7 +46,7 @@ public class CastDevice extends AutoSafeParcelable {
|
||||
this.servicePort = port;
|
||||
this.deviceVersion = deviceVersion;
|
||||
this.friendlyName = friendlyName;
|
||||
this.icons = new ArrayList<WebImage>();
|
||||
this.icons = new ArrayList<>();
|
||||
this.icons.add(new WebImage(Uri.parse(String.format("http://%s:8008%s", this.address, iconPath))));
|
||||
this.modelName = modelName;
|
||||
this.capabilities = capabilities;
|
||||
@ -190,5 +189,5 @@ public class CastDevice extends AutoSafeParcelable {
|
||||
"}";
|
||||
}
|
||||
|
||||
public static Creator<CastDevice> CREATOR = new AutoCreator<CastDevice>(CastDevice.class);
|
||||
public static Creator<CastDevice> CREATOR = new AutoCreator<>(CastDevice.class);
|
||||
}
|
||||
|
@ -45,5 +45,5 @@ public class CastDeviceStatus extends AutoSafeParcelable {
|
||||
@SafeParceled(6)
|
||||
private int standbyState;
|
||||
|
||||
public static final Creator<CastDeviceStatus> CREATOR = new AutoCreator<CastDeviceStatus>(CastDeviceStatus.class);
|
||||
public static final Creator<CastDeviceStatus> CREATOR = new AutoCreator<>(CastDeviceStatus.class);
|
||||
}
|
||||
|
@ -25,5 +25,5 @@ public class JoinOptions extends AutoSafeParcelable {
|
||||
@SafeParceled(2)
|
||||
private int connectionType = 0;
|
||||
|
||||
public static Creator<JoinOptions> CREATOR = new AutoCreator<JoinOptions>(JoinOptions.class);
|
||||
public static Creator<JoinOptions> CREATOR = new AutoCreator<>(JoinOptions.class);
|
||||
}
|
||||
|
@ -43,5 +43,5 @@ public class LaunchOptions extends AutoSafeParcelable {
|
||||
this.relaunchIfRunning = relaunchIfRunning;
|
||||
}
|
||||
|
||||
public static Creator<LaunchOptions> CREATOR = new AutoCreator<LaunchOptions>(LaunchOptions.class);
|
||||
public static Creator<LaunchOptions> CREATOR = new AutoCreator<>(LaunchOptions.class);
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import com.google.android.gms.cast.framework.media.CastMediaOptions;
|
||||
import com.google.android.gms.cast.LaunchOptions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class CastOptions extends AutoSafeParcelable {
|
||||
@SafeParceled(1)
|
||||
@ -61,5 +60,5 @@ public class CastOptions extends AutoSafeParcelable {
|
||||
return this.launchOptions;
|
||||
}
|
||||
|
||||
public static Creator<CastOptions> CREATOR = new AutoCreator<CastOptions>(CastOptions.class);
|
||||
public static Creator<CastOptions> CREATOR = new AutoCreator<>(CastOptions.class);
|
||||
}
|
||||
|
@ -32,5 +32,5 @@ public class CastMediaOptions extends AutoSafeParcelable {
|
||||
@SafeParceled(5)
|
||||
public NotificationOptions notificationOptions;
|
||||
|
||||
public static Creator<CastMediaOptions> CREATOR = new AutoCreator<CastMediaOptions>(CastMediaOptions.class);
|
||||
public static Creator<CastMediaOptions> CREATOR = new AutoCreator<>(CastMediaOptions.class);
|
||||
}
|
||||
|
@ -92,5 +92,5 @@ public class NotificationOptions extends AutoSafeParcelable {
|
||||
@SafeParceled(33)
|
||||
public INotificationActionsProvider notificationActionsProvider;
|
||||
|
||||
public static Creator<NotificationOptions> CREATOR = new AutoCreator<NotificationOptions>(NotificationOptions.class);
|
||||
public static Creator<NotificationOptions> CREATOR = new AutoCreator<>(NotificationOptions.class);
|
||||
}
|
||||
|
@ -89,7 +89,7 @@ public final class Cast {
|
||||
/**
|
||||
* Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the Cast features.
|
||||
*/
|
||||
public static final Api<CastOptions> API = new Api<CastOptions>(new CastApiClientBuilder());
|
||||
public static final Api<CastOptions> API = new Api<>(new CastApiClientBuilder());
|
||||
|
||||
/**
|
||||
* An implementation of the CastApi interface. The interface is used to interact with a cast device.
|
||||
|
@ -32,7 +32,7 @@ public final class CastRemoteDisplay {
|
||||
/**
|
||||
* Token to pass to {@link GoogleApiClient.Builder#addApi(Api)} to enable the CastRemoteDisplay features.
|
||||
*/
|
||||
public static final Api<CastRemoteDisplayOptions> API = new Api<CastRemoteDisplayOptions>(new CastRemoteDisplayApiClientBuilder());
|
||||
public static final Api<CastRemoteDisplayOptions> API = new Api<>(new CastRemoteDisplayApiClientBuilder());
|
||||
|
||||
/**
|
||||
* An implementation of the CastRemoteDisplayAPI interface. The interface is used to interact with a cast device.
|
||||
|
@ -102,10 +102,10 @@ public abstract class AbstractAboutFragment extends Fragment {
|
||||
aboutRoot.findViewById(android.R.id.summary).setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
List<Library> libraries = new ArrayList<Library>();
|
||||
List<Library> libraries = new ArrayList<>();
|
||||
collectLibraries(libraries);
|
||||
Collections.sort(libraries);
|
||||
((ListView) aboutRoot.findViewById(android.R.id.list)).setAdapter(new LibraryAdapter(getContext(), libraries.toArray(new Library[libraries.size()])));
|
||||
((ListView) aboutRoot.findViewById(android.R.id.list)).setAdapter(new LibraryAdapter(getContext(), libraries.toArray(new Library[0])));
|
||||
|
||||
return aboutRoot;
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ import java.util.List;
|
||||
public abstract class AbstractDashboardActivity extends AppCompatActivity {
|
||||
protected int preferencesResource = 0;
|
||||
|
||||
private final List<Condition> conditions = new ArrayList<Condition>();
|
||||
private final List<Condition> conditions = new ArrayList<>();
|
||||
private ViewGroup conditionContainer;
|
||||
|
||||
@Override
|
||||
@ -47,19 +47,13 @@ public abstract class AbstractDashboardActivity extends AppCompatActivity {
|
||||
|
||||
private void evaluateConditionAsync(final Condition condition) {
|
||||
if (condition.willBeEvaluating()) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (condition.isActive(AbstractDashboardActivity.this)) {
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (conditions.contains(condition) && condition.isEvaluated()) {
|
||||
addConditionToView(condition);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
new Thread(() -> {
|
||||
if (condition.isActive(AbstractDashboardActivity.this)) {
|
||||
runOnUiThread(() -> {
|
||||
if (conditions.contains(condition) && condition.isEvaluated()) {
|
||||
addConditionToView(condition);
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
@ -108,16 +108,13 @@ public class Condition {
|
||||
}
|
||||
final View detailGroup = view.findViewById(R.id.detail_group);
|
||||
final ImageView expandIndicator = (ImageView) view.findViewById(R.id.expand_indicator);
|
||||
View.OnClickListener expandListener = new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
if (detailGroup.getVisibility() == View.VISIBLE) {
|
||||
expandIndicator.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_expand_more, context.getTheme()));
|
||||
detailGroup.setVisibility(View.GONE);
|
||||
} else {
|
||||
expandIndicator.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_expand_less, context.getTheme()));
|
||||
detailGroup.setVisibility(View.VISIBLE);
|
||||
}
|
||||
View.OnClickListener expandListener = v -> {
|
||||
if (detailGroup.getVisibility() == View.VISIBLE) {
|
||||
expandIndicator.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_expand_more, context.getTheme()));
|
||||
detailGroup.setVisibility(View.GONE);
|
||||
} else {
|
||||
expandIndicator.setImageDrawable(ResourcesCompat.getDrawable(context.getResources(), R.drawable.ic_expand_less, context.getTheme()));
|
||||
detailGroup.setVisibility(View.VISIBLE);
|
||||
}
|
||||
};
|
||||
view.findViewById(R.id.collapsed_group).setOnClickListener(expandListener);
|
||||
|
@ -40,7 +40,7 @@ import static android.os.Build.VERSION.SDK_INT;
|
||||
public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedChangeListener,
|
||||
View.OnClickListener {
|
||||
|
||||
public static interface OnSwitchChangeListener {
|
||||
public interface OnSwitchChangeListener {
|
||||
/**
|
||||
* Called when the checked state of the Switch has changed.
|
||||
*
|
||||
@ -58,7 +58,7 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
||||
private String mSummary;
|
||||
|
||||
private ArrayList<OnSwitchChangeListener> mSwitchChangeListeners =
|
||||
new ArrayList<OnSwitchChangeListener>();
|
||||
new ArrayList<>();
|
||||
|
||||
public SwitchBar(Context context) {
|
||||
this(context, null);
|
||||
@ -85,12 +85,7 @@ public class SwitchBar extends LinearLayout implements CompoundButton.OnCheckedC
|
||||
mSwitch.setImportantForAccessibility(IMPORTANT_FOR_ACCESSIBILITY_NO);
|
||||
}
|
||||
|
||||
addOnSwitchChangeListener(new OnSwitchChangeListener() {
|
||||
@Override
|
||||
public void onSwitchChanged(SwitchCompat switchView, boolean isChecked) {
|
||||
setTextViewLabel(isChecked);
|
||||
}
|
||||
});
|
||||
addOnSwitchChangeListener((switchView, isChecked) -> setTextViewLabel(isChecked));
|
||||
|
||||
setOnClickListener(this);
|
||||
|
||||
|
@ -30,7 +30,6 @@ import com.google.android.gms.cast.framework.CastOptions;
|
||||
import com.google.android.gms.cast.framework.IAppVisibilityListener;
|
||||
import com.google.android.gms.cast.framework.ICastContext;
|
||||
import com.google.android.gms.cast.framework.IDiscoveryManager;
|
||||
import com.google.android.gms.cast.framework.ISessionManager;
|
||||
import com.google.android.gms.cast.framework.ISessionProvider;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
import com.google.android.gms.dynamic.ObjectWrapper;
|
||||
|
@ -16,7 +16,6 @@
|
||||
|
||||
package com.google.android.gms.cast.framework.internal;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
@ -30,7 +29,6 @@ import com.google.android.gms.cast.framework.ISessionProxy;
|
||||
import com.google.android.gms.cast.framework.media.CastMediaOptions;
|
||||
import com.google.android.gms.cast.framework.internal.CastContextImpl;
|
||||
import com.google.android.gms.cast.framework.internal.CastSessionImpl;
|
||||
import com.google.android.gms.cast.framework.internal.MediaRouterCallbackImpl;
|
||||
import com.google.android.gms.cast.framework.internal.SessionImpl;
|
||||
import com.google.android.gms.cast.framework.media.IMediaNotificationService;
|
||||
import com.google.android.gms.cast.framework.media.internal.IFetchBitmapTask;
|
||||
|
@ -16,14 +16,11 @@
|
||||
|
||||
package com.google.android.gms.cast.framework.internal;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.cast.CastDevice;
|
||||
import com.google.android.gms.cast.framework.ISession;
|
||||
import com.google.android.gms.dynamic.IObjectWrapper;
|
||||
import com.google.android.gms.dynamic.ObjectWrapper;
|
||||
|
||||
public class MediaRouterCallbackImpl extends IMediaRouterCallback.Stub {
|
||||
|
@ -22,7 +22,6 @@ import android.util.Log;
|
||||
|
||||
import com.google.android.gms.cast.framework.CastState;
|
||||
import com.google.android.gms.cast.framework.ICastStateListener;
|
||||
import com.google.android.gms.cast.framework.ISession;
|
||||
import com.google.android.gms.cast.framework.ISessionManager;
|
||||
import com.google.android.gms.cast.framework.ISessionManagerListener;
|
||||
import com.google.android.gms.cast.framework.internal.CastContextImpl;
|
||||
@ -44,7 +43,7 @@ public class SessionManagerImpl extends ISessionManager.Stub {
|
||||
private Set<ISessionManagerListener> sessionManagerListeners = new HashSet<ISessionManagerListener>();
|
||||
private Set<ICastStateListener> castStateListeners = new HashSet<ICastStateListener>();
|
||||
|
||||
private Map<String, SessionImpl> routeSessions = new HashMap<String, SessionImpl>();
|
||||
private Map<String, SessionImpl> routeSessions = new HashMap<>();
|
||||
|
||||
private SessionImpl currentSession;
|
||||
|
||||
|
@ -18,8 +18,6 @@ package com.google.android.gms.cast.media;
|
||||
|
||||
import org.microg.gms.cast.CastMediaRouteProvider;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.mediarouter.media.MediaRouteProvider;
|
||||
import androidx.mediarouter.media.MediaRouteProviderService;
|
||||
|
||||
|
@ -25,7 +25,6 @@ import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.text.Html;
|
||||
import android.util.Log;
|
||||
@ -39,7 +38,6 @@ import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mgoogle.android.gms.R;
|
||||
import com.squareup.wire.Wire;
|
||||
|
||||
import org.microg.gms.common.PackageUtils;
|
||||
import org.microg.gms.people.PeopleManager;
|
||||
@ -119,18 +117,10 @@ public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
||||
if (profileIcon != null) {
|
||||
((ImageView) findViewById(R.id.account_photo)).setImageBitmap(profileIcon);
|
||||
} else {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
final Bitmap profileIcon = PeopleManager.getOwnerAvatarBitmap(AskPermissionActivity.this, account.name, true);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
((ImageView) findViewById(R.id.account_photo)).setImageBitmap(profileIcon);
|
||||
}
|
||||
});
|
||||
new Thread(() -> {
|
||||
final Bitmap profileIcon1 = PeopleManager.getOwnerAvatarBitmap(AskPermissionActivity.this, account.name, true);
|
||||
runOnUiThread(() -> ((ImageView) findViewById(R.id.account_photo)).setImageBitmap(profileIcon1));
|
||||
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
@ -140,18 +130,8 @@ public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
||||
} else {
|
||||
((TextView) findViewById(R.id.title)).setText(getString(R.string.ask_service_permission_title, appLabel));
|
||||
}
|
||||
findViewById(android.R.id.button1).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onAllow();
|
||||
}
|
||||
});
|
||||
findViewById(android.R.id.button2).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onDeny();
|
||||
}
|
||||
});
|
||||
findViewById(android.R.id.button1).setOnClickListener(v -> onAllow());
|
||||
findViewById(android.R.id.button2).setOnClickListener(v -> onDeny());
|
||||
((ListView) findViewById(R.id.permissions)).setAdapter(new PermissionAdapter());
|
||||
}
|
||||
|
||||
@ -161,24 +141,21 @@ public class AskPermissionActivity extends AccountAuthenticatorActivity {
|
||||
findViewById(android.R.id.button2).setEnabled(false);
|
||||
findViewById(R.id.progress_bar).setVisibility(VISIBLE);
|
||||
findViewById(R.id.no_progress_bar).setVisibility(GONE);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
AuthResponse response = authManager.requestAuth(fromAccountManager);
|
||||
Bundle result = new Bundle();
|
||||
result.putString(KEY_AUTHTOKEN, response.auth);
|
||||
result.putString(KEY_ACCOUNT_NAME, account.name);
|
||||
result.putString(KEY_ACCOUNT_TYPE, account.type);
|
||||
result.putString(KEY_ANDROID_PACKAGE_NAME, packageName);
|
||||
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
|
||||
setAccountAuthenticatorResult(result);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
finish();
|
||||
|
||||
new Thread(() -> {
|
||||
try {
|
||||
AuthResponse response = authManager.requestAuth(fromAccountManager);
|
||||
Bundle result = new Bundle();
|
||||
result.putString(KEY_AUTHTOKEN, response.auth);
|
||||
result.putString(KEY_ACCOUNT_NAME, account.name);
|
||||
result.putString(KEY_ACCOUNT_TYPE, account.type);
|
||||
result.putString(KEY_ANDROID_PACKAGE_NAME, packageName);
|
||||
result.putBoolean(AccountManager.KEY_BOOLEAN_RESULT, true);
|
||||
setAccountAuthenticatorResult(result);
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
finish();
|
||||
|
||||
}).start();
|
||||
}
|
||||
|
||||
|
@ -21,9 +21,10 @@ import android.accounts.AccountManager;
|
||||
import android.content.Context;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.os.Build;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import org.microg.gms.common.PackageUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -117,10 +118,7 @@ public class AuthManager {
|
||||
}
|
||||
}
|
||||
String perm = getUserData(buildPermKey());
|
||||
if (!"1".equals(perm)) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
return "1".equals(perm);
|
||||
}
|
||||
|
||||
public void setExpiry(long expiry) {
|
||||
|
@ -137,7 +137,7 @@ public class AuthManagerServiceImpl extends IAuthManagerService.Stub {
|
||||
private List<Scope> getScopes(String scope) {
|
||||
if (!scope.startsWith("oauth2:")) return null;
|
||||
String[] strings = scope.substring(7).split(" ");
|
||||
List<Scope> res = new ArrayList<Scope>();
|
||||
List<Scope> res = new ArrayList<>();
|
||||
for (String string : strings) {
|
||||
res.add(new Scope(string));
|
||||
}
|
||||
|
@ -23,7 +23,6 @@ import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.RelativeLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.StringRes;
|
||||
@ -39,18 +38,8 @@ public abstract class AssistantActivity extends Activity {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.login_assistant);
|
||||
formatTitle();
|
||||
findViewById(R.id.next_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onNextButtonClicked();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.back_button).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
onBackButtonClicked();
|
||||
}
|
||||
});
|
||||
findViewById(R.id.next_button).setOnClickListener(v -> onNextButtonClicked());
|
||||
findViewById(R.id.back_button).setOnClickListener(v -> onBackButtonClicked());
|
||||
}
|
||||
|
||||
@SuppressLint("WrongViewCast")
|
||||
|
@ -21,7 +21,6 @@ import android.accounts.AccountManager;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.annotation.TargetApi;
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.Color;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
@ -36,7 +35,6 @@ import android.view.ViewGroup;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.webkit.CookieManager;
|
||||
import android.webkit.JavascriptInterface;
|
||||
import android.webkit.ValueCallback;
|
||||
import android.webkit.WebSettings;
|
||||
import android.webkit.WebView;
|
||||
import android.webkit.WebViewClient;
|
||||
|
@ -27,8 +27,6 @@ import android.os.Bundle;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mgoogle.android.gms.R;
|
||||
|
||||
import org.microg.gms.auth.AskPermissionActivity;
|
||||
import org.microg.gms.auth.AuthConstants;
|
||||
import org.microg.gms.auth.AuthManager;
|
||||
@ -147,8 +145,10 @@ class AccountAuthenticator extends AbstractAccountAuthenticator {
|
||||
if (services != null) {
|
||||
List<String> servicesList = Arrays.asList(services.split(","));
|
||||
for (String feature : features) {
|
||||
if (feature.startsWith("service_") && !servicesList.contains(feature.substring(8)))
|
||||
if (feature.startsWith("service_") && !servicesList.contains(feature.substring(8))) {
|
||||
res = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
res = false;
|
||||
|
@ -18,14 +18,10 @@ package org.microg.gms.cast;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.Parcel;
|
||||
import android.os.RemoteException;
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.cast.ApplicationMetadata;
|
||||
@ -37,10 +33,7 @@ import com.google.android.gms.cast.LaunchOptions;
|
||||
import com.google.android.gms.cast.internal.ICastDeviceController;
|
||||
import com.google.android.gms.cast.internal.ICastDeviceControllerListener;
|
||||
import com.google.android.gms.common.api.CommonStatusCodes;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.common.images.WebImage;
|
||||
import com.google.android.gms.common.internal.BinderWrapper;
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
|
||||
import su.litvak.chromecast.api.v2.Application;
|
||||
import su.litvak.chromecast.api.v2.ChromeCast;
|
||||
@ -51,7 +44,6 @@ import su.litvak.chromecast.api.v2.ChromeCastRawMessageListener;
|
||||
import su.litvak.chromecast.api.v2.ChromeCastConnectionEvent;
|
||||
import su.litvak.chromecast.api.v2.ChromeCastSpontaneousEvent;
|
||||
import su.litvak.chromecast.api.v2.ChromeCastRawMessage;
|
||||
import su.litvak.chromecast.api.v2.AppEvent;
|
||||
|
||||
public class CastDeviceControllerImpl extends ICastDeviceController.Stub implements
|
||||
ChromeCastConnectionEventListener,
|
||||
@ -107,8 +99,8 @@ public class CastDeviceControllerImpl extends ICastDeviceController.Stub impleme
|
||||
metadata.name = app.name;
|
||||
Log.d(TAG, "unimplemented: ApplicationMetadata.images");
|
||||
Log.d(TAG, "unimplemented: ApplicationMetadata.senderAppLaunchUri");
|
||||
metadata.images = new ArrayList<WebImage>();
|
||||
metadata.namespaces = new ArrayList<String>();
|
||||
metadata.images = new ArrayList<>();
|
||||
metadata.namespaces = new ArrayList<>();
|
||||
for(Namespace namespace : app.namespaces) {
|
||||
metadata.namespaces.add(namespace.name);
|
||||
}
|
||||
@ -119,8 +111,6 @@ public class CastDeviceControllerImpl extends ICastDeviceController.Stub impleme
|
||||
@Override
|
||||
public void spontaneousEventReceived(ChromeCastSpontaneousEvent event) {
|
||||
switch (event.getType()) {
|
||||
case MEDIA_STATUS:
|
||||
break;
|
||||
case STATUS:
|
||||
su.litvak.chromecast.api.v2.Status status = (su.litvak.chromecast.api.v2.Status)event.getData();
|
||||
Application app = status.getRunningApp();
|
||||
@ -132,11 +122,11 @@ public class CastDeviceControllerImpl extends ICastDeviceController.Stub impleme
|
||||
int standbyState = status.standBy ? 1 : 0;
|
||||
this.onDeviceStatusChanged(new CastDeviceStatus(status.volume.level, status.volume.muted, activeInputState, metadata, standbyState));
|
||||
break;
|
||||
case APPEVENT:
|
||||
break;
|
||||
case CLOSE:
|
||||
this.onApplicationDisconnected(CommonStatusCodes.SUCCESS);
|
||||
break;
|
||||
case MEDIA_STATUS:
|
||||
case APPEVENT:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@ -147,12 +137,10 @@ public class CastDeviceControllerImpl extends ICastDeviceController.Stub impleme
|
||||
switch (message.getPayloadType()) {
|
||||
case STRING:
|
||||
String response = message.getPayloadUtf8();
|
||||
if (requestId == null) {
|
||||
this.onTextMessageReceived(message.getNamespace(), response);
|
||||
} else {
|
||||
if (requestId != null) {
|
||||
this.onSendMessageSuccess(response, requestId);
|
||||
this.onTextMessageReceived(message.getNamespace(), response);
|
||||
}
|
||||
this.onTextMessageReceived(message.getNamespace(), response);
|
||||
break;
|
||||
case BINARY:
|
||||
byte[] payload = message.getPayloadBinary();
|
||||
@ -167,7 +155,6 @@ public class CastDeviceControllerImpl extends ICastDeviceController.Stub impleme
|
||||
this.chromecast.disconnect();
|
||||
} catch (IOException e) {
|
||||
Log.e(TAG, "Error disconnecting chromecast: " + e.getMessage());
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@ -178,7 +165,6 @@ public class CastDeviceControllerImpl extends ICastDeviceController.Stub impleme
|
||||
} catch (IOException e) {
|
||||
Log.w(TAG, "Error sending cast message: " + e.getMessage());
|
||||
this.onSendMessageFailure("", requestId, CommonStatusCodes.NETWORK_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -16,26 +16,14 @@
|
||||
|
||||
package org.microg.gms.cast;
|
||||
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.os.Parcel;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
|
||||
import com.google.android.gms.cast.CastDevice;
|
||||
import com.google.android.gms.cast.internal.ICastDeviceControllerListener;
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.BinderWrapper;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.BaseService;
|
||||
import org.microg.gms.common.GmsService;
|
||||
|
||||
import su.litvak.chromecast.api.v2.ChromeCast;
|
||||
import su.litvak.chromecast.api.v2.ChromeCasts;
|
||||
import su.litvak.chromecast.api.v2.Status;
|
||||
import su.litvak.chromecast.api.v2.ChromeCastsListener;
|
||||
|
||||
public class CastDeviceControllerService extends BaseService {
|
||||
private static final String TAG = CastDeviceControllerService.class.getSimpleName();
|
||||
|
||||
|
@ -16,36 +16,13 @@
|
||||
|
||||
package org.microg.gms.cast;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.os.Bundle;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.mediarouter.media.MediaRouteProvider;
|
||||
import androidx.mediarouter.media.MediaRouter;
|
||||
|
||||
import com.google.android.gms.common.images.WebImage;
|
||||
import com.google.android.gms.cast.CastDevice;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.UnknownHostException;
|
||||
import java.io.IOException;
|
||||
import java.lang.Thread;
|
||||
import java.lang.Runnable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
|
||||
import su.litvak.chromecast.api.v2.ChromeCast;
|
||||
import su.litvak.chromecast.api.v2.ChromeCasts;
|
||||
import su.litvak.chromecast.api.v2.Status;
|
||||
import su.litvak.chromecast.api.v2.ChromeCastsListener;
|
||||
|
||||
public class CastMediaRouteController extends MediaRouteProvider.RouteController {
|
||||
private static final String TAG = CastMediaRouteController.class.getSimpleName();
|
||||
|
@ -19,12 +19,9 @@ package org.microg.gms.cast;
|
||||
import android.annotation.SuppressLint;
|
||||
import android.content.Context;
|
||||
import android.content.IntentFilter;
|
||||
import android.net.Uri;
|
||||
import android.net.nsd.NsdManager;
|
||||
import android.net.nsd.NsdServiceInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.AsyncTask;
|
||||
import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
@ -35,33 +32,26 @@ import androidx.mediarouter.media.MediaRouteProvider;
|
||||
import androidx.mediarouter.media.MediaRouteProviderDescriptor;
|
||||
import androidx.mediarouter.media.MediaRouter;
|
||||
|
||||
import com.google.android.gms.common.images.WebImage;
|
||||
import com.google.android.gms.cast.CastDevice;
|
||||
import com.google.android.gms.cast.CastMediaControlIntent;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.InetSocketAddress;
|
||||
import java.net.Inet4Address;
|
||||
import java.net.UnknownHostException;
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.lang.Thread;
|
||||
import java.lang.Runnable;
|
||||
import java.util.List;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public class CastMediaRouteProvider extends MediaRouteProvider {
|
||||
private static final String TAG = CastMediaRouteProvider.class.getSimpleName();
|
||||
|
||||
private Map<String, CastDevice> castDevices = new HashMap<String, CastDevice>();
|
||||
private Map<String, String> serviceCastIds = new HashMap<String, String>();
|
||||
private Map<String, CastDevice> castDevices = new HashMap<>();
|
||||
private Map<String, String> serviceCastIds = new HashMap<>();
|
||||
|
||||
private NsdManager mNsdManager;
|
||||
private NsdManager.DiscoveryListener mDiscoveryListener;
|
||||
|
||||
private List<String> customCategories = new ArrayList<String>();
|
||||
private List<String> customCategories = new ArrayList<>();
|
||||
|
||||
private enum State {
|
||||
NOT_DISCOVERING,
|
||||
@ -71,7 +61,7 @@ public class CastMediaRouteProvider extends MediaRouteProvider {
|
||||
}
|
||||
private State state = State.NOT_DISCOVERING;
|
||||
|
||||
private static final ArrayList<IntentFilter> BASE_CONTROL_FILTERS = new ArrayList<IntentFilter>();
|
||||
private static final ArrayList<IntentFilter> BASE_CONTROL_FILTERS = new ArrayList<>();
|
||||
static {
|
||||
IntentFilter filter;
|
||||
|
||||
@ -215,17 +205,16 @@ public class CastMediaRouteProvider extends MediaRouteProvider {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
String id = new String(attributes.get("id"), "UTF-8");
|
||||
String deviceVersion = new String(attributes.get("ve"), "UTF-8");
|
||||
String friendlyName = new String(attributes.get("fn"), "UTF-8");
|
||||
String modelName = new String(attributes.get("md"), "UTF-8");
|
||||
String iconPath = new String(attributes.get("ic"), "UTF-8");
|
||||
int status = Integer.parseInt(new String(attributes.get("st"), "UTF-8"));
|
||||
String id = new String(attributes.get("id"), StandardCharsets.UTF_8);
|
||||
String deviceVersion = new String(attributes.get("ve"), StandardCharsets.UTF_8);
|
||||
String friendlyName = new String(attributes.get("fn"), StandardCharsets.UTF_8);
|
||||
String modelName = new String(attributes.get("md"), StandardCharsets.UTF_8);
|
||||
String iconPath = new String(attributes.get("ic"), StandardCharsets.UTF_8);
|
||||
int status = Integer.parseInt(new String(attributes.get("st"), StandardCharsets.UTF_8));
|
||||
|
||||
onChromeCastDiscovered(id, name, host, port, deviceVersion, friendlyName, modelName, iconPath, status);
|
||||
} catch (UnsupportedEncodingException | NullPointerException ex) {
|
||||
} catch (NullPointerException ex) {
|
||||
Log.e(TAG, "Error getting cast details from DNS-SD response", ex);
|
||||
return;
|
||||
}
|
||||
}
|
||||
});
|
||||
@ -317,18 +306,13 @@ public class CastMediaRouteProvider extends MediaRouteProvider {
|
||||
|
||||
private void publishRoutesInMainThread() {
|
||||
Handler mainHandler = new Handler(this.getContext().getMainLooper());
|
||||
mainHandler.post(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
publishRoutes();
|
||||
}
|
||||
});
|
||||
mainHandler.post(this::publishRoutes);
|
||||
}
|
||||
|
||||
private void publishRoutes() {
|
||||
MediaRouteProviderDescriptor.Builder builder = new MediaRouteProviderDescriptor.Builder();
|
||||
for (CastDevice castDevice : this.castDevices.values()) {
|
||||
ArrayList<IntentFilter> controlFilters = new ArrayList<IntentFilter>(BASE_CONTROL_FILTERS);
|
||||
ArrayList<IntentFilter> controlFilters = new ArrayList<>(BASE_CONTROL_FILTERS);
|
||||
// Include any app-specific control filters that have been requested.
|
||||
// TODO: Do we need to check with the device?
|
||||
for (String category : this.customCategories) {
|
||||
|
@ -18,22 +18,18 @@ package org.microg.gms.checkin;
|
||||
|
||||
import android.util.Log;
|
||||
|
||||
import com.squareup.wire.Wire;
|
||||
|
||||
import org.microg.gms.common.Build;
|
||||
import org.microg.gms.common.DeviceConfiguration;
|
||||
import org.microg.gms.common.DeviceIdentifier;
|
||||
import org.microg.gms.common.PhoneInfo;
|
||||
import org.microg.gms.common.Utils;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.net.HttpURLConnection;
|
||||
import java.net.URL;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
@ -46,7 +42,7 @@ import java.util.zip.GZIPOutputStream;
|
||||
public class CheckinClient {
|
||||
private static final String TAG = "GmsCheckinClient";
|
||||
private static final Object TODO = null; // TODO
|
||||
private static final List<String> TODO_LIST_STRING = new ArrayList<String>(); // TODO
|
||||
private static final List<String> TODO_LIST_STRING = new ArrayList<>(); // TODO
|
||||
private static final List<CheckinRequest.Checkin.Statistic> TODO_LIST_CHECKIN = new ArrayList<CheckinRequest.Checkin.Statistic>(); // TODO
|
||||
private static final String SERVICE_URL = "https://android.clients.google.com/checkin";
|
||||
|
||||
@ -151,8 +147,8 @@ public class CheckinClient {
|
||||
}
|
||||
if (builder.accountCookie.isEmpty()) builder.accountCookie.add("");
|
||||
if (deviceIdent.wifiMac != null) {
|
||||
builder.macAddress(Arrays.asList(deviceIdent.wifiMac))
|
||||
.macAddressType(Arrays.asList("wifi"));
|
||||
builder.macAddress(Collections.singletonList(deviceIdent.wifiMac))
|
||||
.macAddressType(Collections.singletonList("wifi"));
|
||||
}
|
||||
if (checkinInfo.securityToken != 0) {
|
||||
builder.securityToken(checkinInfo.securityToken)
|
||||
|
@ -20,7 +20,6 @@ import android.accounts.Account;
|
||||
import android.accounts.AccountManager;
|
||||
import android.content.ContentResolver;
|
||||
import android.content.Context;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import org.microg.gms.auth.AuthConstants;
|
||||
import org.microg.gms.auth.AuthRequest;
|
||||
@ -43,7 +42,7 @@ public class CheckinManager {
|
||||
return null;
|
||||
if (!CheckinPrefs.get(context).isEnabled())
|
||||
return null;
|
||||
List<CheckinClient.Account> accounts = new ArrayList<CheckinClient.Account>();
|
||||
List<CheckinClient.Account> accounts = new ArrayList<>();
|
||||
AccountManager accountManager = AccountManager.get(context);
|
||||
String accountType = AuthConstants.DEFAULT_ACCOUNT_TYPE;
|
||||
for (Account account : accountManager.getAccountsByType(accountType)) {
|
||||
|
@ -8,7 +8,8 @@ package org.microg.gms.checkin;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
public class CheckinPrefs implements SharedPreferences.OnSharedPreferenceChangeListener {
|
||||
public static final String PREF_ENABLE_CHECKIN = "checkin_enable_service";
|
||||
|
@ -22,7 +22,6 @@ import android.app.IntentService;
|
||||
import android.content.Intent;
|
||||
import android.os.IBinder;
|
||||
import android.os.RemoteException;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.legacy.content.WakefulBroadcastReceiver;
|
||||
|
@ -20,7 +20,6 @@ import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.legacy.content.WakefulBroadcastReceiver;
|
||||
|
@ -44,10 +44,12 @@ public class Build {
|
||||
}
|
||||
|
||||
private String generateSerialNumber() {
|
||||
String serial = "008741";
|
||||
String serial;
|
||||
Random rand = new Random();
|
||||
StringBuilder serialBuilder = new StringBuilder("008741");
|
||||
for (int i = 0; i < 10; i++)
|
||||
serial += Integer.toString(rand.nextInt(16), 16);
|
||||
serialBuilder.append(Integer.toString(rand.nextInt(16), 16));
|
||||
serial = serialBuilder.toString();
|
||||
serial = serial.toUpperCase(Locale.US);
|
||||
return serial;
|
||||
}
|
||||
|
@ -69,7 +69,7 @@ public class DeviceConfiguration {
|
||||
glEsVersion = configurationInfo.reqGlEsVersion;
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
String[] systemSharedLibraryNames = packageManager.getSystemSharedLibraryNames();
|
||||
sharedLibraries = new ArrayList<String>();
|
||||
sharedLibraries = new ArrayList<>();
|
||||
if (systemSharedLibraryNames != null) sharedLibraries.addAll(Arrays.asList(systemSharedLibraryNames));
|
||||
for (String s : new String[]{"com.google.android.maps", "com.google.android.media.effects", "com.google.widevine.software.drm"}) {
|
||||
if (!sharedLibraries.contains(s)) {
|
||||
@ -77,7 +77,7 @@ public class DeviceConfiguration {
|
||||
}
|
||||
}
|
||||
Collections.sort(sharedLibraries);
|
||||
availableFeatures = new ArrayList<String>();
|
||||
availableFeatures = new ArrayList<>();
|
||||
if (packageManager.getSystemAvailableFeatures() != null) {
|
||||
for (FeatureInfo featureInfo : packageManager.getSystemAvailableFeatures()) {
|
||||
if (featureInfo != null && featureInfo.name != null) availableFeatures.add(featureInfo.name);
|
||||
@ -87,14 +87,14 @@ public class DeviceConfiguration {
|
||||
this.nativePlatforms = getNativePlatforms();
|
||||
widthPixels = displayMetrics.widthPixels;
|
||||
heightPixels = displayMetrics.heightPixels;
|
||||
locales = new ArrayList<String>(Arrays.asList(context.getAssets().getLocales()));
|
||||
locales = new ArrayList<>(Arrays.asList(context.getAssets().getLocales()));
|
||||
for (int i = 0; i < locales.size(); i++) {
|
||||
locales.set(i, locales.get(i).replace("-", "_"));
|
||||
}
|
||||
Collections.sort(locales);
|
||||
Set<String> glExtensions = new HashSet<String>();
|
||||
Set<String> glExtensions = new HashSet<>();
|
||||
addEglExtensions(glExtensions);
|
||||
this.glExtensions = new ArrayList<String>(glExtensions);
|
||||
this.glExtensions = new ArrayList<>(glExtensions);
|
||||
Collections.sort(this.glExtensions);
|
||||
}
|
||||
|
||||
@ -104,7 +104,7 @@ public class DeviceConfiguration {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||
return Arrays.asList(Build.SUPPORTED_ABIS);
|
||||
} else {
|
||||
nativePlatforms = new ArrayList<String>();
|
||||
nativePlatforms = new ArrayList<>();
|
||||
nativePlatforms.add(Build.CPU_ABI);
|
||||
if (Build.CPU_ABI2 != null && !Build.CPU_ABI2.equals("unknown"))
|
||||
nativePlatforms.add(Build.CPU_ABI2);
|
||||
@ -117,7 +117,7 @@ public class DeviceConfiguration {
|
||||
if (egl10 != null) {
|
||||
EGLDisplay display = egl10.eglGetDisplay(EGL10.EGL_DEFAULT_DISPLAY);
|
||||
egl10.eglInitialize(display, new int[2]);
|
||||
int cf[] = new int[1];
|
||||
int[] cf = new int[1];
|
||||
if (egl10.eglGetConfigs(display, null, 0, cf)) {
|
||||
EGLConfig[] configs = new EGLConfig[cf[0]];
|
||||
if (egl10.eglGetConfigs(display, configs, cf[0], cf)) {
|
||||
@ -147,29 +147,23 @@ public class DeviceConfiguration {
|
||||
}
|
||||
}
|
||||
|
||||
private static void addExtensionsForConfig(EGL10 egl10, EGLDisplay egldisplay, EGLConfig eglconfig, int ai[],
|
||||
int ai1[], Set<String> set) {
|
||||
private static void addExtensionsForConfig(EGL10 egl10, EGLDisplay egldisplay, EGLConfig eglconfig, int[] ai,
|
||||
int[] ai1, Set<String> set) {
|
||||
EGLContext eglcontext = egl10.eglCreateContext(egldisplay, eglconfig, EGL10.EGL_NO_CONTEXT, ai1);
|
||||
if (eglcontext != EGL10.EGL_NO_CONTEXT) {
|
||||
javax.microedition.khronos.egl.EGLSurface eglsurface =
|
||||
egl10.eglCreatePbufferSurface(egldisplay, eglconfig, ai);
|
||||
if (eglsurface == EGL10.EGL_NO_SURFACE) {
|
||||
egl10.eglDestroyContext(egldisplay, eglcontext);
|
||||
} else {
|
||||
if (eglsurface != EGL10.EGL_NO_SURFACE) {
|
||||
egl10.eglMakeCurrent(egldisplay, eglsurface, eglsurface, eglcontext);
|
||||
String s = GLES10.glGetString(7939);
|
||||
if (s != null && !s.isEmpty()) {
|
||||
String as[] = s.split(" ");
|
||||
int i = as.length;
|
||||
for (int j = 0; j < i; j++) {
|
||||
set.add(as[j]);
|
||||
}
|
||||
|
||||
String[] as = s.split(" ");
|
||||
set.addAll(Arrays.asList(as).subList(0, as.length));
|
||||
}
|
||||
egl10.eglMakeCurrent(egldisplay, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_SURFACE, EGL10.EGL_NO_CONTEXT);
|
||||
egl10.eglDestroySurface(egldisplay, eglsurface);
|
||||
egl10.eglDestroyContext(egldisplay, eglcontext);
|
||||
}
|
||||
egl10.eglDestroyContext(egldisplay, eglcontext);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,22 +25,24 @@ public class DeviceIdentifier {
|
||||
|
||||
|
||||
private static String randomMacAddress() {
|
||||
String mac = "b407f9";
|
||||
StringBuilder mac = new StringBuilder("b407f9");
|
||||
Random rand = new Random();
|
||||
for (int i = 0; i < 6; i++) {
|
||||
mac += Integer.toString(rand.nextInt(16), 16);
|
||||
mac.append(Integer.toString(rand.nextInt(16), 16));
|
||||
}
|
||||
return mac;
|
||||
return mac.toString();
|
||||
}
|
||||
|
||||
private static String randomMeid() {
|
||||
// http://en.wikipedia.org/wiki/International_Mobile_Equipment_Identity
|
||||
// We start with a known base, and generate random MEID
|
||||
String meid = "35503104";
|
||||
String meid;
|
||||
Random rand = new Random();
|
||||
StringBuilder meidBuilder = new StringBuilder("35503104");
|
||||
for (int i = 0; i < 6; i++) {
|
||||
meid += Integer.toString(rand.nextInt(10));
|
||||
meidBuilder.append(rand.nextInt(10));
|
||||
}
|
||||
meid = meidBuilder.toString();
|
||||
|
||||
// Luhn algorithm (check digit)
|
||||
int sum = 0;
|
||||
|
@ -10,7 +10,6 @@ import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.ContextWrapper;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Resources;
|
||||
import android.os.Build;
|
||||
import android.os.PowerManager;
|
||||
import android.provider.Settings;
|
||||
|
@ -191,14 +191,11 @@ public class HttpFormClient {
|
||||
|
||||
public static <T> void requestAsync(final String url, final Request request, final Class<T> tClass,
|
||||
final Callback<T> callback) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
callback.onResponse(request(url, request, tClass));
|
||||
} catch (Exception e) {
|
||||
callback.onException(e);
|
||||
}
|
||||
new Thread(() -> {
|
||||
try {
|
||||
callback.onResponse(request(url, request, tClass));
|
||||
} catch (Exception e) {
|
||||
callback.onException(e);
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
@ -217,25 +214,25 @@ public class HttpFormClient {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface RequestHeader {
|
||||
public String[] value();
|
||||
String[] value();
|
||||
|
||||
public boolean truePresent() default true;
|
||||
boolean truePresent() default true;
|
||||
|
||||
public boolean falsePresent() default false;
|
||||
boolean falsePresent() default false;
|
||||
|
||||
public boolean nullPresent() default false;
|
||||
boolean nullPresent() default false;
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface RequestContent {
|
||||
public String[] value();
|
||||
String[] value();
|
||||
|
||||
public boolean truePresent() default true;
|
||||
boolean truePresent() default true;
|
||||
|
||||
public boolean falsePresent() default false;
|
||||
boolean falsePresent() default false;
|
||||
|
||||
public boolean nullPresent() default false;
|
||||
boolean nullPresent() default false;
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@ -246,13 +243,13 @@ public class HttpFormClient {
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface ResponseField {
|
||||
public String value();
|
||||
String value();
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
@Target(ElementType.FIELD)
|
||||
public @interface ResponseHeader {
|
||||
public String value();
|
||||
String value();
|
||||
}
|
||||
|
||||
@Retention(RetentionPolicy.RUNTIME)
|
||||
|
@ -22,7 +22,6 @@ import android.util.Log;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.InvocationTargetException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.Collection;
|
||||
@ -33,11 +32,11 @@ public class MultiListenerProxy<T extends IInterface> implements InvocationHandl
|
||||
private static final String TAG = "GmsMultiListener";
|
||||
|
||||
public static <T extends IInterface> T get(Class<T> tClass, final Collection<T> listeners) {
|
||||
return get(tClass, new CollectionListenerPool<T>(listeners));
|
||||
return get(tClass, new CollectionListenerPool<>(listeners));
|
||||
}
|
||||
|
||||
public static <T extends IInterface> T get(Class<T> tClass, final ListenerPool<T> listenerPool) {
|
||||
return (T) Proxy.newProxyInstance(tClass.getClassLoader(), new Class[]{tClass}, new MultiListenerProxy<T>(listenerPool));
|
||||
return (T) Proxy.newProxyInstance(tClass.getClassLoader(), new Class[]{tClass}, new MultiListenerProxy<>(listenerPool));
|
||||
}
|
||||
|
||||
private final ListenerPool<T> listeners;
|
||||
@ -48,7 +47,7 @@ public class MultiListenerProxy<T extends IInterface> implements InvocationHandl
|
||||
|
||||
@Override
|
||||
public Object invoke(Object proxy, Method method, Object[] args) {
|
||||
for (T listener : new HashSet<T>(listeners)) {
|
||||
for (T listener : new HashSet<>(listeners)) {
|
||||
try {
|
||||
method.invoke(listener, args);
|
||||
} catch (Exception e) {
|
||||
|
@ -38,12 +38,12 @@ public class RemoteListenerProxy<T extends IInterface> implements ServiceConnect
|
||||
private final String bindAction;
|
||||
private IBinder remote;
|
||||
private boolean connecting;
|
||||
private List<Runnable> waiting = new ArrayList<Runnable>();
|
||||
private List<Runnable> waiting = new ArrayList<>();
|
||||
private Class<T> tClass;
|
||||
|
||||
public static <T extends IInterface> T get(Context context, Intent intent, Class<T> tClass, String bindAction) {
|
||||
return (T) Proxy.newProxyInstance(tClass.getClassLoader(), new Class[]{tClass},
|
||||
new RemoteListenerProxy<T>(context, intent, tClass, bindAction));
|
||||
new RemoteListenerProxy<>(context, intent, tClass, bindAction));
|
||||
}
|
||||
|
||||
private RemoteListenerProxy(Context context, Intent intent, Class<T> tClass, String bindAction) {
|
||||
@ -117,15 +117,12 @@ public class RemoteListenerProxy<T extends IInterface> implements ServiceConnect
|
||||
@Override
|
||||
public Object invoke(Object proxy, final Method method, final Object[] args) throws Throwable {
|
||||
if (method.getDeclaringClass().equals(tClass)) {
|
||||
runOncePossible(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
try {
|
||||
Object asInterface = Class.forName(tClass.getName() + "$Stub").getMethod("asInterface", IBinder.class).invoke(null, remote);
|
||||
method.invoke(asInterface, args);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
runOncePossible(() -> {
|
||||
try {
|
||||
Object asInterface = Class.forName(tClass.getName() + "$Stub").getMethod("asInterface", IBinder.class).invoke(null, remote);
|
||||
method.invoke(asInterface, args);
|
||||
} catch (Exception e) {
|
||||
Log.w(TAG, e);
|
||||
}
|
||||
});
|
||||
connect();
|
||||
|
@ -18,7 +18,7 @@ package org.microg.gms.common;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
import android.widget.Toast;
|
||||
|
||||
import java.io.ByteArrayOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
|
@ -21,9 +21,10 @@ import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.NetworkInfo;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.util.Log;
|
||||
|
||||
import androidx.preference.PreferenceManager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
@ -20,7 +20,6 @@ import android.os.Handler;
|
||||
import android.util.Log;
|
||||
|
||||
import com.squareup.wire.Message;
|
||||
import com.squareup.wire.Wire;
|
||||
|
||||
import org.microg.gms.gcm.mcs.Close;
|
||||
import org.microg.gms.gcm.mcs.DataMessageStanza;
|
||||
|
@ -72,7 +72,6 @@ import okio.ByteString;
|
||||
|
||||
import static android.app.AlarmManager.ELAPSED_REALTIME_WAKEUP;
|
||||
import static android.os.Build.VERSION.SDK_INT;
|
||||
import static org.microg.gms.common.ForegroundServiceContext.EXTRA_FOREGROUND;
|
||||
import static org.microg.gms.gcm.GcmConstants.ACTION_C2DM_RECEIVE;
|
||||
import static org.microg.gms.gcm.GcmConstants.EXTRA_APP;
|
||||
import static org.microg.gms.gcm.GcmConstants.EXTRA_COLLAPSE_KEY;
|
||||
@ -647,11 +646,8 @@ public class McsService extends Service implements Handler.Callback {
|
||||
}
|
||||
|
||||
private void handleOutputDone(android.os.Message msg) {
|
||||
switch (msg.arg1) {
|
||||
case MCS_HEARTBEAT_PING_TAG:
|
||||
wakeLock.release();
|
||||
break;
|
||||
default:
|
||||
if (msg.arg1 == MCS_HEARTBEAT_PING_TAG) {
|
||||
wakeLock.release();
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -28,19 +28,16 @@ public class UnregisterReceiver extends BroadcastReceiver {
|
||||
Log.d(TAG, "Package removed or data cleared: " + packageName);
|
||||
final GcmDatabase.App app = database.getApp(packageName);
|
||||
if (app != null) {
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
List<GcmDatabase.Registration> registrations = database.getRegistrationsByApp(packageName);
|
||||
boolean deletedAll = true;
|
||||
for (GcmDatabase.Registration registration : registrations) {
|
||||
deletedAll &= PushRegisterManager.unregister(context, registration.packageName, registration.signature, null, null).deleted != null;
|
||||
}
|
||||
if (deletedAll) {
|
||||
database.removeApp(packageName);
|
||||
}
|
||||
database.close();
|
||||
new Thread(() -> {
|
||||
List<GcmDatabase.Registration> registrations = database.getRegistrationsByApp(packageName);
|
||||
boolean deletedAll = true;
|
||||
for (GcmDatabase.Registration registration : registrations) {
|
||||
deletedAll &= PushRegisterManager.unregister(context, registration.packageName, registration.signature, null, null).deleted != null;
|
||||
}
|
||||
if (deletedAll) {
|
||||
database.removeApp(packageName);
|
||||
}
|
||||
database.close();
|
||||
}).start();
|
||||
} else {
|
||||
database.close();
|
||||
|
@ -75,7 +75,7 @@ public class DatabaseHelper extends SQLiteOpenHelper {
|
||||
}
|
||||
|
||||
public Map<String, String> search(String search) {
|
||||
Map<String, String> map = new HashMap<String, String>();
|
||||
Map<String, String> map = new HashMap<>();
|
||||
Cursor cursor = getReadableDatabase().query("overrides", new String[]{"name", "value"},
|
||||
"name LIKE ?", new String[]{search}, null, null, null, null);
|
||||
if (cursor != null) {
|
||||
|
@ -46,8 +46,8 @@ public class GServicesProvider extends ContentProvider {
|
||||
private static final String TAG = "GmsServicesProvider";
|
||||
|
||||
private DatabaseHelper databaseHelper;
|
||||
private Map<String, String> cache = new HashMap<String, String>();
|
||||
private Set<String> cachedPrefixes = new HashSet<String>();
|
||||
private Map<String, String> cache = new HashMap<>();
|
||||
private Set<String> cachedPrefixes = new HashSet<>();
|
||||
|
||||
@Override
|
||||
public boolean onCreate() {
|
||||
|
@ -16,12 +16,10 @@
|
||||
|
||||
package org.microg.gms.measurement;
|
||||
|
||||
import android.os.RemoteException;
|
||||
import android.util.Log;
|
||||
import android.os.RemoteException;
|
||||
|
||||
import com.google.android.gms.common.api.CommonStatusCodes;
|
||||
import com.google.android.gms.common.api.Status;
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.api.CommonStatusCodes;
|
||||
import com.google.android.gms.common.internal.GetServiceRequest;
|
||||
import com.google.android.gms.common.internal.IGmsCallbacks;
|
||||
|
||||
import org.microg.gms.BaseService;
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user