Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6ec9e89f authored by Stefanot's avatar Stefanot
Browse files

Add SuggestionFeatureProvider interface.

The interface is added so that a vendor can add new suggestions to the
settings app, and customize details for these suggestions.

Test: make RunSettingsRoboTests

BUG: 34219298

Change-Id: I373c63709b1aaf68360aa2561a2ecfc3194e0e2b
parent 0d3d5e4a
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -26,4 +26,10 @@ public interface SuggestionFeatureProvider {
     */
    boolean isSmartSuggestionEnabled(Context context);

    /** Return true if className is the name of a class of one of your newly added suggestion. */
    boolean isPresent(String className);

    /** Return true if the suggestion has already been completed and does not need to be shown */
    boolean isSuggestionCompleted(Context context);

}
 No newline at end of file
+10 −0
Original line number Diff line number Diff line
@@ -25,4 +25,14 @@ public class SuggestionFeatureProviderImpl implements SuggestionFeatureProvider
        return false;
    }

    @Override
    public boolean isPresent(String className) {
        return false;
    }

    @Override
    public boolean isSuggestionCompleted(Context context) {
        return false;
    }

}
+8 −0
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ import com.android.settings.Settings.WifiCallingSuggestionActivity;
import com.android.settings.Settings.ZenModeAutomationSuggestionActivity;
import com.android.settings.Utils;
import com.android.settings.WallpaperSuggestionActivity;
import com.android.settings.overlay.FeatureFactory;
import com.android.settingslib.drawer.Tile;

import java.util.Collection;
@@ -67,6 +68,13 @@ public class SuggestionsChecks {
        } else if (className.equals(FingerprintEnrollSuggestionActivity.class.getName())) {
            return isDeviceSecured() || !isFingerprintEnabled();
        }

        SuggestionFeatureProvider provider =
            FeatureFactory.getFactory(mContext).getSuggestionFeatureProvider();
        if (provider != null && provider.isPresent(className)) {
            return provider.isSuggestionCompleted(mContext);
        }

        return false;
    }