mirror of
https://github.com/TeamVanced/VancedMicroG
synced 2024-09-12 17:26:53 +02:00
Fix device registration pref and debloat
This commit is contained in:
parent
067a602137
commit
e6329fddc5
14
README.md
14
README.md
@ -12,9 +12,15 @@ This fork tweaks MicroG to be usable by applications that require Google authent
|
|||||||
- No longer a system app
|
- No longer a system app
|
||||||
- Package name changed from `com.google.android.gms` to `com.mgoogle.android.gms` to support installation alongside the official MicroG
|
- Package name changed from `com.google.android.gms` to `com.mgoogle.android.gms` to support installation alongside the official MicroG
|
||||||
- Removed unnecessary features:
|
- Removed unnecessary features:
|
||||||
- Maps & Location
|
- Ads
|
||||||
- Wear-Api
|
- Analytics
|
||||||
- Safetynet
|
|
||||||
- Games
|
|
||||||
- Car
|
- Car
|
||||||
|
- Games
|
||||||
|
- Location
|
||||||
|
- Maps & Location
|
||||||
|
- SafetyNet
|
||||||
|
- Self-Check
|
||||||
|
- TapandPay
|
||||||
|
- Wallet
|
||||||
|
- Wear-Api
|
||||||
- Removed all permissions, as none are required for Google authentication
|
- Removed all permissions, as none are required for Google authentication
|
||||||
|
@ -1,4 +0,0 @@
|
|||||||
package com.google.android.gms.ads;
|
|
||||||
|
|
||||||
interface AdManagerCreator {
|
|
||||||
}
|
|
@ -1,8 +0,0 @@
|
|||||||
package com.google.android.gms.ads.identifier.internal;
|
|
||||||
|
|
||||||
interface IAdvertisingIdService {
|
|
||||||
String getAdvertisingId() = 0;
|
|
||||||
boolean isAdTrackingLimited(boolean defaultHint) = 1;
|
|
||||||
String generateAdvertisingId(String packageName) = 2;
|
|
||||||
void setAdTrackingLimited(String packageName, boolean limited) = 3;
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.google.android.gms.location.places.internal;
|
|
||||||
|
|
||||||
interface IGooglePlaceDetectionService {
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.google.android.gms.location.places.internal;
|
|
||||||
|
|
||||||
interface IGooglePlacesService {
|
|
||||||
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
parcelable AccountState;
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
parcelable CreateReminderOptionsInternal;
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
parcelable LoadRemindersOptions;
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
parcelable ReindexDueDatesOptions;
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
parcelable UpdateRecurrenceOptions;
|
|
@ -1,17 +0,0 @@
|
|||||||
package com.google.android.gms.reminders.internal;
|
|
||||||
|
|
||||||
import com.google.android.gms.common.api.Status;
|
|
||||||
import com.google.android.gms.common.data.DataHolder;
|
|
||||||
|
|
||||||
import com.google.android.gms.reminders.AccountState;
|
|
||||||
|
|
||||||
interface IRemindersCallbacks {
|
|
||||||
void onDataHolder(in DataHolder data, in Status status) = 0;
|
|
||||||
void onStatus(in Status status) = 1;
|
|
||||||
void onNoStatus() = 2;
|
|
||||||
void onDataHolderNoStatus(in DataHolder data, in Status status) = 3;
|
|
||||||
void onBool(boolean b, in Status status) = 4;
|
|
||||||
void onString(in String s, in Status status) = 5;
|
|
||||||
void onAccountState(in AccountState accountState, in Status status) = 6;
|
|
||||||
void onAsyncDataHolder(in DataHolder data) = 7;
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.google.android.gms.reminders.internal;
|
|
||||||
|
|
||||||
interface IRemindersListener {
|
|
||||||
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package com.google.android.gms.reminders.internal;
|
|
||||||
|
|
||||||
import com.google.android.gms.reminders.internal.IRemindersCallbacks;
|
|
||||||
|
|
||||||
import com.google.android.gms.reminders.AccountState;
|
|
||||||
import com.google.android.gms.reminders.CreateReminderOptionsInternal;
|
|
||||||
import com.google.android.gms.reminders.LoadRemindersOptions;
|
|
||||||
import com.google.android.gms.reminders.ReindexDueDatesOptions;
|
|
||||||
import com.google.android.gms.reminders.UpdateRecurrenceOptions;
|
|
||||||
import com.google.android.gms.reminders.model.CustomizedSnoozePresetEntity;
|
|
||||||
import com.google.android.gms.reminders.model.TaskEntity;
|
|
||||||
import com.google.android.gms.reminders.model.TaskIdEntity;
|
|
||||||
|
|
||||||
interface IRemindersService {
|
|
||||||
void loadReminders(IRemindersCallbacks callbacks, in LoadRemindersOptions options) = 0;
|
|
||||||
void addListener(IRemindersCallbacks callbacks) = 1;
|
|
||||||
void createReminder(IRemindersCallbacks callbacks, in TaskEntity task) = 2;
|
|
||||||
void updateReminder(IRemindersCallbacks callbacks, in TaskEntity task) = 3;
|
|
||||||
void deleteReminder(IRemindersCallbacks callbacks, in TaskIdEntity taskId) = 4;
|
|
||||||
void bumpReminder(IRemindersCallbacks callbacks, in TaskIdEntity taskId) = 5;
|
|
||||||
void hasUpcomingReminders(IRemindersCallbacks callbacks) = 6;
|
|
||||||
void createRecurrence(IRemindersCallbacks callbacks, in TaskEntity task) = 7;
|
|
||||||
void updateRecurrence(IRemindersCallbacks callbacks, String s1, in TaskEntity task, in UpdateRecurrenceOptions options) = 8;
|
|
||||||
void deleteRecurrence(IRemindersCallbacks callbacks, String s1, in UpdateRecurrenceOptions options) = 9;
|
|
||||||
void changeRecurrence(IRemindersCallbacks callbacks, String s1, in TaskEntity task, in UpdateRecurrenceOptions options) = 10;
|
|
||||||
void makeTaskRecurring(IRemindersCallbacks callbacks, in TaskEntity task) = 11;
|
|
||||||
void makeRecurrenceSingleInstance(IRemindersCallbacks callbacks, String s1, in TaskEntity task, in UpdateRecurrenceOptions options) = 12;
|
|
||||||
void clearListeners() = 13;
|
|
||||||
void batchUpdateReminders(IRemindersCallbacks callbacks, in List<TaskEntity> tasks) = 14;
|
|
||||||
void createReminderWithOptions(IRemindersCallbacks callbacks, in TaskEntity task, in CreateReminderOptionsInternal options) = 15;
|
|
||||||
void getCustomizedSnoozePreset(IRemindersCallbacks callbacks) = 16;
|
|
||||||
void setCustomizedSnoozePreset(IRemindersCallbacks callbacks, in CustomizedSnoozePresetEntity preset) = 17;
|
|
||||||
void setAccountState(IRemindersCallbacks callbacks, in AccountState accountState) = 18;
|
|
||||||
void getAccountState(IRemindersCallbacks callbacks) = 19;
|
|
||||||
void checkReindexDueDatesNeeded(IRemindersCallbacks callbacks, in ReindexDueDatesOptions options) = 20;
|
|
||||||
void reindexDueDates(IRemindersCallbacks callbacks, in ReindexDueDatesOptions options) = 21;
|
|
||||||
}
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.google.android.gms.reminders.model;
|
|
||||||
|
|
||||||
parcelable CustomizedSnoozePresetEntity;
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.google.android.gms.reminders.model;
|
|
||||||
|
|
||||||
parcelable TaskEntity;
|
|
@ -1,3 +0,0 @@
|
|||||||
package com.google.android.gms.reminders.model;
|
|
||||||
|
|
||||||
parcelable TaskIdEntity;
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.google.android.gms.tapandpay.internal;
|
|
||||||
|
|
||||||
interface ITapAndPayService {
|
|
||||||
|
|
||||||
}
|
|
@ -1,5 +0,0 @@
|
|||||||
package com.google.android.gms.wallet.internal;
|
|
||||||
|
|
||||||
interface IOwService {
|
|
||||||
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
import org.microg.safeparcel.AutoSafeParcelable;
|
|
||||||
|
|
||||||
public class AccountState extends AutoSafeParcelable {
|
|
||||||
public static Creator<AccountState> CREATOR = new AutoCreator<AccountState>(AccountState.class);
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
import org.microg.safeparcel.AutoSafeParcelable;
|
|
||||||
|
|
||||||
public class CreateReminderOptionsInternal extends AutoSafeParcelable {
|
|
||||||
public static Creator<CreateReminderOptionsInternal> CREATOR = new AutoCreator<CreateReminderOptionsInternal>(CreateReminderOptionsInternal.class);
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
import org.microg.safeparcel.AutoSafeParcelable;
|
|
||||||
|
|
||||||
public class LoadRemindersOptions extends AutoSafeParcelable {
|
|
||||||
public static Creator<LoadRemindersOptions> CREATOR = new AutoCreator<LoadRemindersOptions>(LoadRemindersOptions.class);
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
import org.microg.safeparcel.AutoSafeParcelable;
|
|
||||||
|
|
||||||
public class ReindexDueDatesOptions extends AutoSafeParcelable {
|
|
||||||
public static Creator<ReindexDueDatesOptions> CREATOR = new AutoCreator<ReindexDueDatesOptions>(ReindexDueDatesOptions.class);
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.gms.reminders;
|
|
||||||
|
|
||||||
import org.microg.safeparcel.AutoSafeParcelable;
|
|
||||||
|
|
||||||
public class UpdateRecurrenceOptions extends AutoSafeParcelable {
|
|
||||||
public static Creator<UpdateRecurrenceOptions> CREATOR = new AutoCreator<UpdateRecurrenceOptions>(UpdateRecurrenceOptions.class);
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.gms.reminders.model;
|
|
||||||
|
|
||||||
import org.microg.safeparcel.AutoSafeParcelable;
|
|
||||||
|
|
||||||
public class CustomizedSnoozePresetEntity extends AutoSafeParcelable {
|
|
||||||
public static Creator<CustomizedSnoozePresetEntity> CREATOR = new AutoCreator<CustomizedSnoozePresetEntity>(CustomizedSnoozePresetEntity.class);
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.gms.reminders.model;
|
|
||||||
|
|
||||||
import org.microg.safeparcel.AutoSafeParcelable;
|
|
||||||
|
|
||||||
public class TaskEntity extends AutoSafeParcelable {
|
|
||||||
public static Creator<TaskEntity> CREATOR = new AutoCreator<TaskEntity>(TaskEntity.class);
|
|
||||||
}
|
|
@ -1,23 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.gms.reminders.model;
|
|
||||||
|
|
||||||
import org.microg.safeparcel.AutoSafeParcelable;
|
|
||||||
|
|
||||||
public class TaskIdEntity extends AutoSafeParcelable {
|
|
||||||
public static Creator<TaskIdEntity> CREATOR = new AutoCreator<TaskIdEntity>(TaskIdEntity.class);
|
|
||||||
}
|
|
@ -1,77 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.microg.tools.selfcheck;
|
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.content.pm.PackageManager;
|
|
||||||
import android.content.pm.PermissionGroupInfo;
|
|
||||||
import android.content.pm.PermissionInfo;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
import org.microg.tools.ui.R;
|
|
||||||
|
|
||||||
import static android.os.Build.VERSION_CODES.M;
|
|
||||||
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Negative;
|
|
||||||
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Positive;
|
|
||||||
|
|
||||||
@TargetApi(M)
|
|
||||||
public class PermissionCheckGroup implements SelfCheckGroup {
|
|
||||||
private static final String TAG = "SelfCheckPerms";
|
|
||||||
|
|
||||||
private String[] permissions;
|
|
||||||
|
|
||||||
public PermissionCheckGroup(String... permissions) {
|
|
||||||
this.permissions = permissions;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String getGroupName(Context context) {
|
|
||||||
return context.getString(R.string.self_check_cat_permissions);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void doChecks(Context context, ResultCollector collector) {
|
|
||||||
for (String permission : permissions) {
|
|
||||||
doPermissionCheck(context, collector, permission);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private void doPermissionCheck(Context context, ResultCollector collector, final String permission) {
|
|
||||||
PackageManager pm = context.getPackageManager();
|
|
||||||
try {
|
|
||||||
PermissionInfo info = pm.getPermissionInfo(permission, 0);
|
|
||||||
PermissionGroupInfo groupInfo = info.group != null ? pm.getPermissionGroupInfo(info.group, 0) : null;
|
|
||||||
CharSequence permLabel = info.loadLabel(pm);
|
|
||||||
CharSequence groupLabel = groupInfo != null ? groupInfo.loadLabel(pm) : permLabel;
|
|
||||||
collector.addResult(context.getString(R.string.self_check_name_permission, permLabel),
|
|
||||||
context.checkSelfPermission(permission) == PackageManager.PERMISSION_GRANTED ? Positive : Negative,
|
|
||||||
context.getString(R.string.self_check_resolution_permission, groupLabel),
|
|
||||||
new SelfCheckGroup.CheckResolver() {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void tryResolve(Fragment fragment) {
|
|
||||||
fragment.requestPermissions(new String[]{permission}, 0);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
} catch (PackageManager.NameNotFoundException e) {
|
|
||||||
Log.w(TAG, e);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,41 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.microg.tools.selfcheck;
|
|
||||||
|
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
public interface SelfCheckGroup {
|
|
||||||
String getGroupName(Context context);
|
|
||||||
|
|
||||||
void doChecks(Context context, ResultCollector collector);
|
|
||||||
|
|
||||||
interface ResultCollector {
|
|
||||||
void addResult(String name, Result value, String resolution);
|
|
||||||
|
|
||||||
void addResult(String name, Result value, String resolution, CheckResolver resolver);
|
|
||||||
}
|
|
||||||
|
|
||||||
interface CheckResolver {
|
|
||||||
void tryResolve(Fragment fragment);
|
|
||||||
}
|
|
||||||
|
|
||||||
enum Result {
|
|
||||||
Positive, Negative, Unknown
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,128 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package org.microg.tools.ui;
|
|
||||||
|
|
||||||
import android.os.Bundle;
|
|
||||||
import android.util.Log;
|
|
||||||
import android.view.LayoutInflater;
|
|
||||||
import android.view.MotionEvent;
|
|
||||||
import android.view.View;
|
|
||||||
import android.view.ViewGroup;
|
|
||||||
import android.widget.CheckBox;
|
|
||||||
import android.widget.TextView;
|
|
||||||
|
|
||||||
import androidx.annotation.Nullable;
|
|
||||||
import androidx.fragment.app.Fragment;
|
|
||||||
|
|
||||||
import org.microg.tools.selfcheck.SelfCheckGroup;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
import static android.view.View.GONE;
|
|
||||||
import static android.view.View.INVISIBLE;
|
|
||||||
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Negative;
|
|
||||||
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Positive;
|
|
||||||
import static org.microg.tools.selfcheck.SelfCheckGroup.Result.Unknown;
|
|
||||||
|
|
||||||
public abstract class AbstractSelfCheckFragment extends Fragment {
|
|
||||||
private static final String TAG = "SelfCheck";
|
|
||||||
|
|
||||||
private ViewGroup root;
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
|
|
||||||
View scrollRoot = inflater.inflate(R.layout.self_check, container, false);
|
|
||||||
root = (ViewGroup) scrollRoot.findViewById(R.id.self_check_root);
|
|
||||||
reset(inflater);
|
|
||||||
return scrollRoot;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected abstract void prepareSelfCheckList(List<SelfCheckGroup> checks);
|
|
||||||
|
|
||||||
protected void reset(LayoutInflater inflater) {
|
|
||||||
List<SelfCheckGroup> selfCheckGroupList = new ArrayList<SelfCheckGroup>();
|
|
||||||
prepareSelfCheckList(selfCheckGroupList);
|
|
||||||
|
|
||||||
root.removeAllViews();
|
|
||||||
for (SelfCheckGroup group : selfCheckGroupList) {
|
|
||||||
View groupView = inflater.inflate(R.layout.self_check_group, root, false);
|
|
||||||
((TextView) groupView.findViewById(android.R.id.title)).setText(group.getGroupName(getContext()));
|
|
||||||
final ViewGroup viewGroup = (ViewGroup) groupView.findViewById(R.id.group_content);
|
|
||||||
final SelfCheckGroup.ResultCollector collector = new GroupResultCollector(viewGroup);
|
|
||||||
try {
|
|
||||||
group.doChecks(getContext(), collector);
|
|
||||||
} catch (Exception e) {
|
|
||||||
Log.w(TAG, "Failed during check " + group.getGroupName(getContext()), e);
|
|
||||||
collector.addResult("Self-check failed:", Negative, "An exception occurred during self-check. Please report this issue.");
|
|
||||||
}
|
|
||||||
root.addView(groupView);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private class GroupResultCollector implements SelfCheckGroup.ResultCollector {
|
|
||||||
private final ViewGroup viewGroup;
|
|
||||||
|
|
||||||
public GroupResultCollector(ViewGroup viewGroup) {
|
|
||||||
this.viewGroup = viewGroup;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResult(final String name, final SelfCheckGroup.Result result, final String resolution) {
|
|
||||||
addResult(name, result, resolution, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void addResult(final String name, final SelfCheckGroup.Result result, final String resolution,
|
|
||||||
final SelfCheckGroup.CheckResolver resolver) {
|
|
||||||
if (result == null || getActivity() == null) return;
|
|
||||||
getActivity().runOnUiThread(new Runnable() {
|
|
||||||
@Override
|
|
||||||
public void run() {
|
|
||||||
View resultEntry = LayoutInflater.from(getContext()).inflate(R.layout.self_check_entry, viewGroup, false);
|
|
||||||
((TextView) resultEntry.findViewById(R.id.self_check_name)).setText(name);
|
|
||||||
resultEntry.findViewById(R.id.self_check_result).setOnTouchListener(new View.OnTouchListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onTouch(View v, MotionEvent event) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
if (result == Positive) {
|
|
||||||
((CheckBox) resultEntry.findViewById(R.id.self_check_result)).setChecked(true);
|
|
||||||
resultEntry.findViewById(R.id.self_check_resolution).setVisibility(GONE);
|
|
||||||
} else {
|
|
||||||
((TextView) resultEntry.findViewById(R.id.self_check_resolution)).setText(resolution);
|
|
||||||
if (result == Unknown) {
|
|
||||||
resultEntry.findViewById(R.id.self_check_result).setVisibility(INVISIBLE);
|
|
||||||
}
|
|
||||||
if (resolver != null) {
|
|
||||||
resultEntry.setClickable(true);
|
|
||||||
resultEntry.setOnClickListener(new View.OnClickListener() {
|
|
||||||
@Override
|
|
||||||
public void onClick(View v) {
|
|
||||||
resolver.tryResolve(AbstractSelfCheckFragment.this);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
viewGroup.addView(resultEntry);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2013-2017 microG Project Team
|
|
||||||
~
|
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
~ you may not use this file except in compliance with the License.
|
|
||||||
~ You may obtain a copy of the License at
|
|
||||||
~
|
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
~ See the License for the specific language governing permissions and
|
|
||||||
~ limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<ScrollView
|
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/self_check_root"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
</ScrollView>
|
|
@ -1,58 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2013-2017 microG Project Team
|
|
||||||
~
|
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
~ you may not use this file except in compliance with the License.
|
|
||||||
~ You may obtain a copy of the License at
|
|
||||||
~
|
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
~ See the License for the specific language governing permissions and
|
|
||||||
~ limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:background="?attr/selectableItemBackground"
|
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal"
|
|
||||||
android:paddingBottom="5dp"
|
|
||||||
android:paddingEnd="?android:attr/listPreferredItemPaddingEnd"
|
|
||||||
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
|
|
||||||
android:paddingRight="?attr/listPreferredItemPaddingRight"
|
|
||||||
android:paddingStart="?android:attr/listPreferredItemPaddingStart">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="0dip"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/self_check_name"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="?attr/textAppearanceListItem"
|
|
||||||
android:textColor="?android:textColorPrimary"/>
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/self_check_resolution"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
|
|
||||||
android:textColor="?android:textColorSecondary"/>
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<CheckBox
|
|
||||||
android:id="@+id/self_check_result"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:focusable="false"
|
|
||||||
android:gravity="right|center_vertical"
|
|
||||||
android:paddingTop="5dp"/>
|
|
||||||
</LinearLayout>
|
|
@ -1,40 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<!--
|
|
||||||
~ Copyright (C) 2013-2017 microG Project Team
|
|
||||||
~
|
|
||||||
~ Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
~ you may not use this file except in compliance with the License.
|
|
||||||
~ You may obtain a copy of the License at
|
|
||||||
~
|
|
||||||
~ http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
~
|
|
||||||
~ Unless required by applicable law or agreed to in writing, software
|
|
||||||
~ distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
~ See the License for the specific language governing permissions and
|
|
||||||
~ limitations under the License.
|
|
||||||
-->
|
|
||||||
|
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@android:id/title"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginBottom="16dip"
|
|
||||||
android:paddingLeft="?attr/listPreferredItemPaddingLeft"
|
|
||||||
android:paddingRight="?attr/listPreferredItemPaddingRight"
|
|
||||||
android:paddingTop="16dip"
|
|
||||||
android:textAppearance="@style/TextAppearance.AppCompat.Body2"
|
|
||||||
android:textColor="?attr/colorAccent"/>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:id="@+id/group_content"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="vertical"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
@ -1,32 +0,0 @@
|
|||||||
/*
|
|
||||||
* Copyright (C) 2013-2017 microG Project Team
|
|
||||||
*
|
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
||||||
* you may not use this file except in compliance with the License.
|
|
||||||
* You may obtain a copy of the License at
|
|
||||||
*
|
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
*
|
|
||||||
* Unless required by applicable law or agreed to in writing, software
|
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
* See the License for the specific language governing permissions and
|
|
||||||
* limitations under the License.
|
|
||||||
*/
|
|
||||||
|
|
||||||
package com.google.android.gms.analytics.service;
|
|
||||||
|
|
||||||
import android.app.Service;
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.os.IBinder;
|
|
||||||
import android.util.Log;
|
|
||||||
|
|
||||||
public class AnalyticsService extends Service {
|
|
||||||
private static final String TAG = "GmsAnalyticsSvc";
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public IBinder onBind(Intent intent) {
|
|
||||||
Log.d(TAG, "onBind: " + intent);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
}
|
|
@ -34,7 +34,7 @@ public class CheckinPrefs implements SharedPreferences.OnSharedPreferenceChangeL
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void update() {
|
private void update() {
|
||||||
checkinEnabled = preferences.getBoolean(PREF_ENABLE_CHECKIN, false);
|
checkinEnabled = preferences.getBoolean(PREF_ENABLE_CHECKIN, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user