MD5 校验值:7cd346351ab05a28e42aff65173e0141
LogoutService.java 文件包含反编译后的源代码,请注意,该内容仅供学习和参考使用,不得用于非法用途。
package com.leptonsoftware.fibernet.services; import android.app.KeyguardManager; import android.app.Service; import android.content.Intent; import android.content.SharedPreferences; import android.location.Location; import android.location.LocationManager; import android.os.IBinder; import android.os.Process; import android.util.Log; import com.android.volley.VolleyError; import com.android.volley.j; import com.android.volley.k; import com.android.volley.m; import com.android.volley.toolbox.k; import com.android.volley.toolbox.l; import com.leptonsoftware.fibernet.TrackingService; import com.leptonsoftware.fibernet.constants; import com.leptonsoftware.fibernet.jioscreens.LoginActivity; import com.leptonsoftware.fibernet.jsonparser.ApiType; import com.leptonsoftware.fibernet.jsonparser.WebApi; import com.leptonsoftware.fibernet.toasty.Toasty; import com.leptonsoftware.fibernet.util.AppConstants; import com.leptonsoftware.fibernet.util.AppUtil; import com.leptonsoftware.fibernet.util.SharePrefConstants; import com.leptonsoftware.fibernet.util.SharePrefFactory; import java.util.Calendar; import java.util.HashMap; import java.util.Iterator; import java.util.Map; import java.util.TimeZone; import org.json.JSONArray; import org.json.JSONException; import org.json.JSONObject; public class LogoutService extends Service { private static String TAG = "LogoutService"; public Integer count; public String current_logout_addresss; public boolean isRunning = false; public LocationManager mLocationManagerGLOBAL; private LogoutThread mythread; public String refresh_token; public String reverse_geocodeURL; public String user_id; class LogoutThread extends Thread { long DELAY; SharedPreferences pref; LogoutThread() { SharedPreferences sharedPreferences = LogoutService.this.getApplicationContext().getSharedPreferences("MyPref", 0); this.pref = sharedPreferences; this.DELAY = sharedPreferences.getLong("auto_logout_time", 0L); } @Override public void run() { while (LogoutService.this.isRunning) { Log.d(LogoutService.TAG, "Running"); try { Thread.sleep(60000L); if (Long.valueOf(Calendar.getInstance(TimeZone.getTimeZone("GMT+5:30")).getTimeInMillis()).longValue() - Long.valueOf(LogoutService.this.getSharedPreferences("nikhil1", 0).getLong("lastInteractTime", 0L)).longValue() >= this.DELAY) { Location lastKnownLocation = LogoutService.this.getLastKnownLocation(); LogoutService.this.stopService(new Intent(LogoutService.this, (Class<?>) TrackingService.class)); LogoutService logoutService = LogoutService.this; logoutService.isRunning = false; constants.isTrackOn = "trackOFF"; logoutService.autoLogoutUser2(lastKnownLocation); } } catch (InterruptedException e10) { e10.printStackTrace(); } } } } public Location getLastKnownLocation() { LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(AppConstants.Offline_Location_Action); this.mLocationManagerGLOBAL = locationManager; Iterator<String> it = locationManager.getProviders(true).iterator(); Location location = null; while (it.hasNext()) { Location lastKnownLocation = this.mLocationManagerGLOBAL.getLastKnownLocation(it.next()); if (lastKnownLocation != null && (location == null || lastKnownLocation.getAccuracy() < location.getAccuracy())) { location = lastKnownLocation; } } return location; } public void autoLogoutUser2(final Location location) { Intent intent; Intent intent2; Intent intent3; Intent intent4; ((KeyguardManager) getApplicationContext().getSystemService("keyguard")).inKeyguardRestrictedInputMode(); SharedPreferences sharedPreferences = getApplicationContext().getSharedPreferences("MyPref", 0); this.user_id = sharedPreferences.getString("user_id", null); this.refresh_token = sharedPreferences.getString("refresh_token", null); this.reverse_geocodeURL = sharedPreferences.getString("reverse_geocodeURL", null); String str = this.refresh_token; if (str == null) { stopService(new Intent(getApplicationContext(), (Class<?>) TrackingService.class)); stopService(new Intent(getApplicationContext(), (Class<?>) LogoutService.class)); if (AppUtil.isJioPartnerFiber()) { intent4 = new Intent(getApplicationContext(), (Class<?>) LoginActivity.class); } else { intent4 = new Intent(getApplicationContext(), (Class<?>) com.leptonsoftware.fibernet.LoginActivity.class); } intent4.addFlags(268435456); startActivity(intent4); stopSelf(); return; } if (str.toLowerCase().equals(null)) { this.refresh_token = null; stopService(new Intent(getApplicationContext(), (Class<?>) TrackingService.class)); stopService(new Intent(getApplicationContext(), (Class<?>) LogoutService.class)); if (AppUtil.isJioPartnerFiber()) { intent3 = new Intent(getApplicationContext(), (Class<?>) LoginActivity.class); } else { intent3 = new Intent(getApplicationContext(), (Class<?>) com.leptonsoftware.fibernet.LoginActivity.class); } intent3.addFlags(268435456); startActivity(intent3); stopSelf(); return; } if (this.refresh_token.toLowerCase().equals(null)) { return; } LocationManager locationManager = (LocationManager) getApplicationContext().getSystemService(AppConstants.Offline_Location_Action); this.mLocationManagerGLOBAL = locationManager; if (!locationManager.isProviderEnabled("gps")) { this.refresh_token = null; stopService(new Intent(getApplicationContext(), (Class<?>) TrackingService.class)); stopService(new Intent(getApplicationContext(), (Class<?>) LogoutService.class)); if (AppUtil.isJioPartnerFiber()) { intent2 = new Intent(getApplicationContext(), (Class<?>) LoginActivity.class); } else { intent2 = new Intent(getApplicationContext(), (Class<?>) com.leptonsoftware.fibernet.LoginActivity.class); } intent2.addFlags(268435456); startActivity(intent2); stopSelf(); return; } Location lastKnownLocation = getLastKnownLocation(); if (lastKnownLocation == null) { this.refresh_token = null; stopService(new Intent(getApplicationContext(), (Class<?>) TrackingService.class)); stopService(new Intent(getApplicationContext(), (Class<?>) LogoutService.class)); if (AppUtil.isJioPartnerFiber()) { intent = new Intent(getApplicationContext(), (Class<?>) LoginActivity.class); } else { intent = new Intent(getApplicationContext(), (Class<?>) com.leptonsoftware.fibernet.LoginActivity.class); } intent.addFlags(268435456); startActivity(intent); stopSelf(); return; } String stringPref = SharePrefFactory.getStringPref(this, SharePrefConstants.gck); String stringPref2 = SharePrefFactory.getStringPref(this, SharePrefConstants.gck2); final j a10 = l.a(getApplicationContext()); k kVar = new k(0, this.reverse_geocodeURL + "latlng=" + String.valueOf(lastKnownLocation.getLatitude()) + "," + String.valueOf(lastKnownLocation.getLongitude()) + "&key=" + AppUtil.fromBase64(stringPref) + AppUtil.fromBase64(stringPref2), new k.b<String>() { @Override public void onResponse(String str2) { try { JSONObject jSONObject = new JSONObject(new JSONArray(new JSONObject(str2).getString("results")).get(0).toString()); LogoutService.this.current_logout_addresss = jSONObject.get("formatted_address").toString(); a10.e(); final j a11 = l.a(LogoutService.this.getApplicationContext()); com.android.volley.toolbox.k kVar2 = new com.android.volley.toolbox.k(1, WebApi.getWebApi(ApiType.LOGOUT), new k.b<String>() { @Override public void onResponse(String str3) { try { new JSONObject(str3); LogoutService.this.refresh_token = null; LogoutService.this.stopService(new Intent(LogoutService.this.getApplicationContext(), (Class<?>) TrackingService.class)); LogoutService.this.stopService(new Intent(LogoutService.this.getApplicationContext(), (Class<?>) LogoutService.class)); Intent launchIntentForPackage = LogoutService.this.getBaseContext().getPackageManager().getLaunchIntentForPackage(LogoutService.this.getBaseContext().getPackageName()); launchIntentForPackage.setFlags(268468224); LogoutService.this.startActivity(launchIntentForPackage); Process.killProcess(Process.myPid()); System.exit(0); LogoutService.this.stopSelf(); a11.e(); } catch (JSONException unused) { Toasty.info(LogoutService.this.getApplicationContext(), "Something went wrong"); a11.e(); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { Toasty.info(LogoutService.this.getApplicationContext(), "Problems Connecting to Internet.Try Again"); volleyError.printStackTrace(); a11.e(); } }) { @Override protected Map<String, String> getParams() { HashMap hashMap = new HashMap(); hashMap.put("refresh_token", LogoutService.this.refresh_token); hashMap.put("latitude", String.valueOf(location.getLatitude())); hashMap.put("longitude", String.valueOf(location.getLongitude())); hashMap.put("address", LogoutService.this.current_logout_addresss); return hashMap; } }; kVar2.setRetryPolicy(new m() { @Override public int getCurrentRetryCount() { return 50000; } @Override public int getCurrentTimeout() { return 50000; } @Override public void retry(VolleyError volleyError) { } }); a11.a(kVar2); } catch (JSONException unused) { Toasty.info(LogoutService.this.getApplicationContext(), "Something went wrong"); a10.e(); } } }, new k.a() { @Override public void onErrorResponse(VolleyError volleyError) { Toasty.info(LogoutService.this.getApplicationContext(), "Request Timed out due to Poor Connection Try Again" + volleyError.toString()); volleyError.printStackTrace(); a10.e(); } }) { }; kVar.setRetryPolicy(new m() { @Override public int getCurrentRetryCount() { return 50000; } @Override public int getCurrentTimeout() { return 50000; } @Override public void retry(VolleyError volleyError) { } }); a10.a(kVar); } @Override public IBinder onBind(Intent intent) { return null; } @Override public void onCreate() { super.onCreate(); Log.d(TAG, "onCreate"); this.mythread = new LogoutThread(); } @Override public synchronized void onDestroy() { super.onDestroy(); Log.d(TAG, "onDestroy"); if (!this.isRunning) { try { this.mythread.interrupt(); this.count = 0; } catch (Exception e10) { e10.printStackTrace(); } } } @Override public int onStartCommand(Intent intent, int i10, int i11) { super.onStartCommand(intent, i10, i11); Log.d(TAG, "onStart"); if (!this.isRunning) { this.mythread.start(); this.isRunning = true; } return 1; } }