cleanup 2

This commit is contained in:
X1nto 2020-07-27 18:40:47 +04:00
parent 2d893fabe7
commit a6dd7ac2b6
4 changed files with 1 additions and 164 deletions

View File

@ -1,49 +0,0 @@
/*
* Copyright (C) 2019 e Foundation
*
* 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.gms.firebase.dynamiclinks;
import android.app.Service;
import android.content.Intent;
import android.os.IBinder;
import android.util.Log;
import android.os.RemoteException;
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;
import org.microg.gms.common.GmsService;
import org.microg.gms.common.PackageUtils;
import org.microg.gms.firebase.dynamiclinks.DynamicLinksServiceImpl;
public class DynamicLinksService extends BaseService {
private static final String TAG = "GmsDynamicLinksService";
public DynamicLinksService() {
super("GmsDynamicLinksSvc", GmsService.DYNAMIC_LINKS);
}
@Override
public void handleServiceRequest(IGmsCallbacks callback, GetServiceRequest request, GmsService service) throws RemoteException {
PackageUtils.getAndCheckCallingPackage(this, request.packageName);
Log.d(TAG, "callb: " + callback + " ; req: " + request + " ; serv: " + service);
callback.onPostInitComplete(0, new DynamicLinksServiceImpl(this, request.packageName, request.extras), null);
}
}

View File

@ -1,64 +0,0 @@
/*
* Copyright (C) 2019 e Foundation
*
* 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.gms.firebase.dynamiclinks;
import android.os.Parcel;
import android.os.RemoteException;
import android.os.Bundle;
import android.util.Log;
import android.content.Context;
import android.content.Intent;
import com.google.android.gms.common.api.Status;
import com.google.android.gms.common.api.CommonStatusCodes;
import com.google.firebase.dynamiclinks.internal.IDynamicLinksService;
import com.google.firebase.dynamiclinks.internal.IDynamicLinksCallbacks;
import com.google.firebase.dynamiclinks.internal.DynamicLinkData;
import com.google.firebase.dynamiclinks.internal.ShortDynamicLink;
public class DynamicLinksServiceImpl extends IDynamicLinksService.Stub {
private static final String TAG = "GmsDynamicLinksServImpl";
public DynamicLinksServiceImpl(Context context, String packageName, Bundle extras) {
}
@Override
public void getInitialLink(IDynamicLinksCallbacks callback, String var2) throws RemoteException {
callback.onStatusDynamicLinkData(Status.SUCCESS, new DynamicLinkData());
}
@Override
public void func2(IDynamicLinksCallbacks callback, Bundle var2) throws RemoteException {
Log.d(TAG, "func2: " + callback + ", " + var2);
callback.onStatusShortDynamicLink(Status.SUCCESS, new ShortDynamicLink());
}
@Override
public boolean onTransact(int code, Parcel data, Parcel reply, int flags) throws RemoteException {
if (super.onTransact(code, data, reply, flags)) {
return true;
}
Log.d(TAG, "onTransact [unknown]: " + code + ", " + data + ", " + flags);
return false;
}
}

View File

@ -17,8 +17,6 @@
package org.microg.gms.ui;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.text.TextUtils;
import androidx.annotation.Nullable;
import androidx.fragment.app.Fragment;
@ -27,12 +25,9 @@ import com.mgoogle.android.gms.R;
import org.microg.gms.gcm.GcmDatabase;
import org.microg.gms.gcm.GcmPrefs;
//import org.microg.nlp.Preferences;
import org.microg.tools.ui.AbstractDashboardActivity;
import org.microg.tools.ui.ResourceSettingsFragment;
import static org.microg.gms.checkin.TriggerReceiver.PREF_ENABLE_CHECKIN;
public class SettingsActivity extends AbstractDashboardActivity {
public SettingsActivity() {
@ -88,8 +83,6 @@ public class SettingsActivity extends AbstractDashboardActivity {
// Preferences.splitBackendString(unifiedNlPrefs.getGeocoderBackends()).length;
// findPreference(PREF_UNIFIEDNLP).setSummary(getResources().getQuantityString(R.plurals.pref_unifiednlp_summary, backendCount, backendCount));
boolean checkinEnabled = PreferenceManager.getDefaultSharedPreferences(getContext()).getBoolean(PREF_ENABLE_CHECKIN, true);
findPreference(PREF_CHECKIN).setSummary(checkinEnabled ? R.string.service_status_enabled : R.string.service_status_disabled);
}
}
}

View File

@ -5,21 +5,16 @@ import android.os.Bundle;
import androidx.annotation.Nullable;
import androidx.navigation.fragment.NavHostFragment;
import com.google.android.gms.R;
import com.mgoogle.android.gms.R;
import org.microg.gms.checkin.CheckinPrefs;
import org.microg.gms.gcm.GcmDatabase;
import org.microg.gms.gcm.GcmPrefs;
import org.microg.gms.snet.SafetyNetPrefs;
import org.microg.tools.ui.ResourceSettingsFragment;
public class SettingsFragment extends ResourceSettingsFragment {
public static final String PREF_ABOUT = "pref_about";
public static final String PREF_GCM = "pref_gcm";
public static final String PREF_SNET = "pref_snet";
public static final String PREF_UNIFIEDNLP = "pref_unifiednlp";
public static final String PREF_CHECKIN = "pref_checkin";
public SettingsFragment() {
preferencesResource = R.xml.preferences_start;
@ -55,43 +50,5 @@ public class SettingsFragment extends ResourceSettingsFragment {
NavHostFragment.findNavController(SettingsFragment.this).navigate(R.id.openGcmSettings);
return true;
});
if (SafetyNetPrefs.get(getContext()).isEnabled()) {
String snet_info = "";
if (SafetyNetPrefs.get(getContext()).isOfficial()) {
snet_info = getString(R.string.pref_snet_status_official_info);
} else if (SafetyNetPrefs.get(getContext()).isSelfSigned()) {
snet_info = getString(R.string.pref_snet_status_self_signed_info);
} else if (SafetyNetPrefs.get(getContext()).isThirdParty()) {
snet_info = getString(R.string.pref_snet_status_third_party_info);
}
findPreference(PREF_SNET).setSummary(getString(R.string.service_status_enabled_short));
} else {
findPreference(PREF_SNET).setSummary(R.string.service_status_disabled_short);
}
findPreference(PREF_SNET).setOnPreferenceClickListener(preference -> {
NavHostFragment.findNavController(SettingsFragment.this).navigate(R.id.openSafetyNetSettings);
return true;
});
// Preferences unifiedNlPrefs = new Preferences(getContext());
// int backendCount = TextUtils.isEmpty(unifiedNlPrefs.getLocationBackends()) ? 0 :
// Preferences.splitBackendString(unifiedNlPrefs.getLocationBackends()).length;
// backendCount += TextUtils.isEmpty(unifiedNlPrefs.getGeocoderBackends()) ? 0 :
// Preferences.splitBackendString(unifiedNlPrefs.getGeocoderBackends()).length;
// findPreference(PREF_UNIFIEDNLP).setSummary(getResources().getQuantityString(R.plurals.pref_unifiednlp_summary, backendCount, backendCount));
findPreference(PREF_UNIFIEDNLP).setOnPreferenceClickListener(preference -> {
NavHostFragment.findNavController(SettingsFragment.this).navigate(R.id.openUnifiedNlpSettings);
return true;
});
boolean checkinEnabled = CheckinPrefs.get(getContext()).isEnabled();
findPreference(PREF_CHECKIN).setSummary(checkinEnabled ? R.string.service_status_enabled_short : R.string.service_status_disabled_short);
findPreference(PREF_CHECKIN).setOnPreferenceClickListener(preference -> {
NavHostFragment.findNavController(SettingsFragment.this).navigate(R.id.openCheckinSettings);
return true;
});
}
}