Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit df820cb7 authored by Fynn Godau's avatar Fynn Godau Committed by Jonathan Klee
Browse files

Use new profile init code in licensing service

parent 574a3597
Loading
Loading
Loading
Loading
+8 −33
Original line number Diff line number Diff line
@@ -48,8 +48,6 @@ public class LicensingService extends Service {

    private static final String KEY_V2_RESULT_JWT = "LICENSE_DATA";

    private static final Uri PROFILE_PROVIDER = Uri.parse("content://com.google.android.gms.microg.profile");

    private static final Uri CHECKIN_SETTINGS_PROVIDER = Uri.parse("content://com.google.android.gms.microg.settings/check-in");

    private final ILicensingService.Stub mLicenseService = new ILicensingService.Stub() {
@@ -157,42 +155,19 @@ public class LicensingService extends Service {

    public IBinder onBind(Intent intent) {

        ProfileManager.ensureInitialized(this);

        Cursor cursor = null;
        try {
            cursor = getContentResolver().query(
                PROFILE_PROVIDER, null, null, null, null
            );

            if (cursor == null || cursor.getColumnCount() != 2) {
                Log.e(TAG, "profile provider not available");
            } else {
                Map<String, String> profileData = new HashMap<>();
                while (cursor.moveToNext()) {
                    profileData.put(cursor.getString(0), cursor.getString(1));
                }
                ProfileManager.INSTANCE.applyProfileData(profileData);
            }

        } finally {
            if (cursor != null) {
                cursor.close();
            }
        }

        try {
            cursor = getContentResolver().query(
                    CHECKIN_SETTINGS_PROVIDER, new String[] { "androidId" }, null, null, null
            );

        try (Cursor cursor = getContentResolver().query(
                CHECKIN_SETTINGS_PROVIDER,
                new String[]{"androidId"},
                null,
                null,
                null
        )) {
            if (cursor != null) {
                cursor.moveToNext();
                androidId = Long.toHexString(cursor.getLong(0));
            }
        } finally {
            if (cursor != null) {
                cursor.close();
            }
        }

        queue = Volley.newRequestQueue(this);