Loading vending-app/src/main/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="org.microg.gms.permission.READ_SETTINGS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" android:maxSdkVersion="22" /> Loading vending-app/src/main/java/com/android/vending/licensing/LicensingService.java +37 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; import org.microg.gms.auth.AuthConstants; import org.microg.gms.profile.Build; import org.microg.gms.profile.ProfileManager; import java.util.Arrays; Loading @@ -48,14 +47,45 @@ public class LicensingService extends Service { private String androidId; private static final Uri SETTINGS_PROVIDER = Uri.parse("content://com.google.android.gms.microg.settings/play"); private static final String PREFERENCE_LICENSING_ENABLED = "play_licensing"; private final ILicensingService.Stub mLicenseService = new ILicensingService.Stub() { private boolean shouldCheckLicense() { Cursor cursor = null; try { cursor = getContentResolver().query( SETTINGS_PROVIDER, new String[]{PREFERENCE_LICENSING_ENABLED}, null, null, null ); if (cursor == null || cursor.getColumnCount() != 1) { Log.e(TAG, "settings provider not available"); return false; } else { cursor.moveToNext(); return cursor.getInt(0) != 0; } } finally { if (cursor != null) { cursor.close(); } } } @Override public void checkLicense(long nonce, String packageName, ILicenseResultListener listener) throws RemoteException { Log.v(TAG, "checkLicense(" + nonce + ", " + packageName + ")"); if (!shouldCheckLicense()) { Log.d(TAG, "not checking license, as it is disabled by user"); return; } Account[] accounts = accountManager.getAccountsByType(AuthConstants.DEFAULT_ACCOUNT_TYPE); PackageManager packageManager = getPackageManager(); Loading Loading @@ -85,6 +115,11 @@ public class LicensingService extends Service { public void checkLicenseV2(String packageName, ILicenseV2ResultListener listener, Bundle extraParams) throws RemoteException { Log.v(TAG, "checkLicenseV2(" + packageName + ", " + extraParams + ")"); if (!shouldCheckLicense()) { Log.d(TAG, "not checking license, as it is disabled by user"); return; } Account[] accounts = accountManager.getAccountsByType(AuthConstants.DEFAULT_ACCOUNT_TYPE); PackageManager packageManager = getPackageManager(); Loading Loading
vending-app/src/main/AndroidManifest.xml +2 −0 Original line number Diff line number Diff line Loading @@ -13,6 +13,8 @@ <uses-permission android:name="android.permission.POST_NOTIFICATIONS"/> <uses-permission android:name="android.permission.GET_ACCOUNTS" /> <uses-permission android:name="org.microg.gms.permission.READ_SETTINGS" /> <uses-permission android:name="android.permission.USE_CREDENTIALS" android:maxSdkVersion="22" /> Loading
vending-app/src/main/java/com/android/vending/licensing/LicensingService.java +37 −2 Original line number Diff line number Diff line Loading @@ -25,7 +25,6 @@ import com.android.volley.RequestQueue; import com.android.volley.toolbox.Volley; import org.microg.gms.auth.AuthConstants; import org.microg.gms.profile.Build; import org.microg.gms.profile.ProfileManager; import java.util.Arrays; Loading @@ -48,14 +47,45 @@ public class LicensingService extends Service { private String androidId; private static final Uri SETTINGS_PROVIDER = Uri.parse("content://com.google.android.gms.microg.settings/play"); private static final String PREFERENCE_LICENSING_ENABLED = "play_licensing"; private final ILicensingService.Stub mLicenseService = new ILicensingService.Stub() { private boolean shouldCheckLicense() { Cursor cursor = null; try { cursor = getContentResolver().query( SETTINGS_PROVIDER, new String[]{PREFERENCE_LICENSING_ENABLED}, null, null, null ); if (cursor == null || cursor.getColumnCount() != 1) { Log.e(TAG, "settings provider not available"); return false; } else { cursor.moveToNext(); return cursor.getInt(0) != 0; } } finally { if (cursor != null) { cursor.close(); } } } @Override public void checkLicense(long nonce, String packageName, ILicenseResultListener listener) throws RemoteException { Log.v(TAG, "checkLicense(" + nonce + ", " + packageName + ")"); if (!shouldCheckLicense()) { Log.d(TAG, "not checking license, as it is disabled by user"); return; } Account[] accounts = accountManager.getAccountsByType(AuthConstants.DEFAULT_ACCOUNT_TYPE); PackageManager packageManager = getPackageManager(); Loading Loading @@ -85,6 +115,11 @@ public class LicensingService extends Service { public void checkLicenseV2(String packageName, ILicenseV2ResultListener listener, Bundle extraParams) throws RemoteException { Log.v(TAG, "checkLicenseV2(" + packageName + ", " + extraParams + ")"); if (!shouldCheckLicense()) { Log.d(TAG, "not checking license, as it is disabled by user"); return; } Account[] accounts = accountManager.getAccountsByType(AuthConstants.DEFAULT_ACCOUNT_TYPE); PackageManager packageManager = getPackageManager(); Loading