Tie ContextualWifiSlice to UI instead of garbage collector
- Introduce a static long in SliceFeatureProvider that updates once every "session". A session is when user is in an UI (screen rotation, going to subpage, etc does not break the continuation of session). - Use session token in ContextualWifiSlice to determine when to refresh, instead of relying on WeakHashMap from CustomSliceManager. WeakHashMap can be cleaned up at any time by gc so it doesn't match what we want on the UI. - Also as a side fix, merged CustomSliceManager into SliceFeatureProvider. Fixes: 123937830 Test: robo Change-Id: I199bceceb208b99a32f3f08e624787b5a03e73a9
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package com.android.settings.slices;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
|
||||
import com.android.settings.network.telephony.Enhanced4gLteSliceHelper;
|
||||
import com.android.settings.wifi.calling.WifiCallingSliceHelper;
|
||||
@@ -14,6 +15,20 @@ public interface SlicesFeatureProvider {
|
||||
|
||||
SliceDataConverter getSliceDataConverter(Context context);
|
||||
|
||||
/**
|
||||
* Starts a new UI session for the purpose of using Slices.
|
||||
*
|
||||
* A UI session is defined as an duration of time when user stays in a UI screen. Screen
|
||||
* rotation does not break the continuation of session, going to a sub-page and coming out does
|
||||
* not break the continuation either. Leaving the page and coming back breaks it.
|
||||
*/
|
||||
void newUiSession();
|
||||
|
||||
/**
|
||||
* Returns the token created in {@link #newUiSession}.
|
||||
*/
|
||||
long getUiSessionToken();
|
||||
|
||||
/**
|
||||
* Asynchronous call to index the data used to build Slices.
|
||||
* If the data is already indexed, the data will not change.
|
||||
@@ -26,7 +41,14 @@ public interface SlicesFeatureProvider {
|
||||
*/
|
||||
void indexSliceData(Context context);
|
||||
|
||||
CustomSliceManager getCustomSliceManager(Context context);
|
||||
|
||||
/**
|
||||
* Return a {@link CustomSliceable} associated to the Uri.
|
||||
* <p>
|
||||
* Do not change this method signature to accommodate for a special-case sliceable - a context
|
||||
* is the only thing that should be needed to create the object.
|
||||
*/
|
||||
CustomSliceable getSliceableFromUri(Context context, Uri uri);
|
||||
|
||||
/**
|
||||
* Gets new WifiCallingSliceHelper object
|
||||
|
Reference in New Issue
Block a user