Search in sources :

Example 1 with SavedNetworkTracker

use of com.android.wifitrackerlib.SavedNetworkTracker in project android_packages_apps_Settings by omnirom.

the class SavedAccessPointsWifiSettings2 method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final Context context = getContext();
    mWorkerThread = new HandlerThread(TAG + "{" + Integer.toHexString(System.identityHashCode(this)) + "}", Process.THREAD_PRIORITY_BACKGROUND);
    mWorkerThread.start();
    final Clock elapsedRealtimeClock = new SimpleClock(ZoneOffset.UTC) {

        @Override
        public long millis() {
            return SystemClock.elapsedRealtime();
        }
    };
    mSavedNetworkTracker = new SavedNetworkTracker(getSettingsLifecycle(), context, context.getSystemService(WifiManager.class), context.getSystemService(ConnectivityManager.class), context.getSystemService(NetworkScoreManager.class), new Handler(Looper.getMainLooper()), mWorkerThread.getThreadHandler(), elapsedRealtimeClock, MAX_SCAN_AGE_MILLIS, SCAN_INTERVAL_MILLIS, this);
}
Also used : Context(android.content.Context) HandlerThread(android.os.HandlerThread) SimpleClock(android.os.SimpleClock) Handler(android.os.Handler) SystemClock(android.os.SystemClock) Clock(java.time.Clock) SimpleClock(android.os.SimpleClock) SavedNetworkTracker(com.android.wifitrackerlib.SavedNetworkTracker)

Example 2 with SavedNetworkTracker

use of com.android.wifitrackerlib.SavedNetworkTracker in project android_packages_apps_Settings by omnirom.

the class WifiNetworkListFragment method onActivityCreated.

@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    final Context context = getContext();
    mWifiManager = context.getSystemService(WifiManager.class);
    mSaveListener = new WifiManager.ActionListener() {

        @Override
        public void onSuccess() {
        // Do nothing.
        }

        @Override
        public void onFailure(int reason) {
            final Activity activity = getActivity();
            if (activity != null && !activity.isFinishing()) {
                Toast.makeText(activity, R.string.wifi_failed_save_message, Toast.LENGTH_SHORT).show();
            }
        }
    };
    mWorkerThread = new HandlerThread(TAG + "{" + Integer.toHexString(System.identityHashCode(this)) + "}", Process.THREAD_PRIORITY_BACKGROUND);
    mWorkerThread.start();
    final Clock elapsedRealtimeClock = new SimpleClock(ZoneOffset.UTC) {

        @Override
        public long millis() {
            return SystemClock.elapsedRealtime();
        }
    };
    mSavedNetworkTracker = new SavedNetworkTracker(getSettingsLifecycle(), context, context.getSystemService(WifiManager.class), context.getSystemService(ConnectivityManager.class), context.getSystemService(NetworkScoreManager.class), new Handler(Looper.getMainLooper()), mWorkerThread.getThreadHandler(), elapsedRealtimeClock, MAX_SCAN_AGE_MILLIS, SCAN_INTERVAL_MILLIS, this);
}
Also used : Context(android.content.Context) WifiManager(android.net.wifi.WifiManager) HandlerThread(android.os.HandlerThread) SimpleClock(android.os.SimpleClock) Activity(android.app.Activity) Handler(android.os.Handler) SystemClock(android.os.SystemClock) Clock(java.time.Clock) SimpleClock(android.os.SimpleClock) SavedNetworkTracker(com.android.wifitrackerlib.SavedNetworkTracker)

Aggregations

Context (android.content.Context)2 Handler (android.os.Handler)2 HandlerThread (android.os.HandlerThread)2 SimpleClock (android.os.SimpleClock)2 SystemClock (android.os.SystemClock)2 SavedNetworkTracker (com.android.wifitrackerlib.SavedNetworkTracker)2 Clock (java.time.Clock)2 Activity (android.app.Activity)1 WifiManager (android.net.wifi.WifiManager)1