Search in sources :

Example 6 with SimpleClock

use of android.os.SimpleClock in project android_packages_apps_Settings by omnirom.

the class ConfigureWifiEntryFragment method setupNetworkDetailsTracker.

private void setupNetworkDetailsTracker() {
    if (mNetworkDetailsTracker != null) {
        return;
    }
    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();
        }
    };
    mNetworkDetailsTracker = FeatureFactory.getFactory(context).getWifiTrackerLibProvider().createNetworkDetailsTracker(getSettingsLifecycle(), context, new Handler(Looper.getMainLooper()), mWorkerThread.getThreadHandler(), elapsedRealtimeClock, MAX_SCAN_AGE_MILLIS, SCAN_INTERVAL_MILLIS, getArguments().getString(WifiNetworkDetailsFragment.KEY_CHOSEN_WIFIENTRY_KEY));
}
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)

Example 7 with SimpleClock

use of android.os.SimpleClock 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 8 with SimpleClock

use of android.os.SimpleClock 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)

Example 9 with SimpleClock

use of android.os.SimpleClock in project android_packages_apps_Settings by omnirom.

the class WifiNetworkDetailsFragment method setupNetworksDetailTracker.

private void setupNetworksDetailTracker() {
    if (mNetworkDetailsTracker != null) {
        return;
    }
    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();
        }
    };
    mNetworkDetailsTracker = FeatureFactory.getFactory(context).getWifiTrackerLibProvider().createNetworkDetailsTracker(getSettingsLifecycle(), context, new Handler(Looper.getMainLooper()), mWorkerThread.getThreadHandler(), elapsedRealtimeClock, MAX_SCAN_AGE_MILLIS, SCAN_INTERVAL_MILLIS, getArguments().getString(KEY_CHOSEN_WIFIENTRY_KEY));
}
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)

Aggregations

Handler (android.os.Handler)9 HandlerThread (android.os.HandlerThread)9 SimpleClock (android.os.SimpleClock)9 SystemClock (android.os.SystemClock)9 Clock (java.time.Clock)9 Context (android.content.Context)7 WifiManager (android.net.wifi.WifiManager)3 Activity (android.app.Activity)2 SavedNetworkTracker (com.android.wifitrackerlib.SavedNetworkTracker)2 Intent (android.content.Intent)1 Bundle (android.os.Bundle)1 Nullable (androidx.annotation.Nullable)1 SettingsActivity (com.android.settings.SettingsActivity)1 AccessPoint (com.android.settingslib.wifi.AccessPoint)1