use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class AppInfoDashboardFragment method getNumberOfUserWithPackageInstalled.
@VisibleForTesting
int getNumberOfUserWithPackageInstalled(String packageName) {
final List<UserInfo> userInfos = mUserManager.getUsers(true);
int count = 0;
for (final UserInfo userInfo : userInfos) {
try {
// Use this API to check whether user has this package
final ApplicationInfo info = mPm.getApplicationInfoAsUser(packageName, PackageManager.GET_META_DATA, userInfo.id);
if ((info.flags & ApplicationInfo.FLAG_INSTALLED) != 0) {
count++;
}
} catch (NameNotFoundException e) {
Log.e(TAG, "Package: " + packageName + " not found for user: " + userInfo.id);
}
}
return count;
}
use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DataUsageList method updatePolicy.
/**
* Update chart sweeps and cycle list to reflect {@link NetworkPolicy} for
* current {@link #mTemplate}.
*/
@VisibleForTesting
void updatePolicy() {
final NetworkPolicy policy = services.mPolicyEditor.getPolicy(mTemplate);
final View configureButton = mHeader.findViewById(R.id.filter_settings);
// SUB SELECT
if (isNetworkPolicyModifiable(policy, mSubId) && isMobileDataAvailable(mSubId)) {
mChart.setNetworkPolicy(policy);
configureButton.setVisibility(View.VISIBLE);
((ImageView) configureButton).setColorFilter(android.R.color.white);
} else {
// controls are disabled; don't bind warning/limit sweeps
mChart.setNetworkPolicy(null);
configureButton.setVisibility(View.GONE);
}
// generate cycle list based on policy and available history
if (mCycleAdapter.updateCycleList(mCycleData)) {
updateDetailData();
}
}
use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class DatePreferenceController method setDate.
@VisibleForTesting
void setDate(int year, int month, int day) {
Calendar c = Calendar.getInstance();
c.set(Calendar.YEAR, year);
c.set(Calendar.MONTH, month);
c.set(Calendar.DAY_OF_MONTH, day);
long when = Math.max(c.getTimeInMillis(), DatePreferenceHost.MIN_DATE);
if (when / 1000 < Integer.MAX_VALUE) {
((AlarmManager) mContext.getSystemService(Context.ALARM_SERVICE)).setTime(when);
}
}
use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class ContextualCardLoader method getDisplayableCards.
// Get final displayed cards and log what cards will be displayed/hidden
@VisibleForTesting
List<ContextualCard> getDisplayableCards(List<ContextualCard> candidates) {
final List<ContextualCard> eligibleCards = filterEligibleCards(candidates);
final List<ContextualCard> visibleCards = new ArrayList<>();
final List<ContextualCard> hiddenCards = new ArrayList<>();
final int size = eligibleCards.size();
for (int i = 0; i < size; i++) {
if (i < DEFAULT_CARD_COUNT) {
visibleCards.add(eligibleCards.get(i));
} else {
hiddenCards.add(eligibleCards.get(i));
}
}
if (!CardContentProvider.DELETE_CARD_URI.equals(mNotifyUri)) {
final MetricsFeatureProvider metricsFeatureProvider = FeatureFactory.getFactory(mContext).getMetricsFeatureProvider();
metricsFeatureProvider.action(mContext, SettingsEnums.ACTION_CONTEXTUAL_CARD_NOT_SHOW, ContextualCardLogUtils.buildCardListLog(hiddenCards));
}
return visibleCards;
}
use of androidx.annotation.VisibleForTesting in project Resurrection_packages_apps_Settings by ResurrectionRemix.
the class SettingsHomepageActivity method setHomepageContainerPaddingTop.
@VisibleForTesting
void setHomepageContainerPaddingTop() {
final View view = this.findViewById(R.id.homepage_container);
final int searchBarHeight = getResources().getDimensionPixelSize(R.dimen.search_bar_height);
final int searchBarMargin = getResources().getDimensionPixelSize(R.dimen.search_bar_margin);
// The top padding is the height of action bar(48dp) + top/bottom margins(16dp)
final int paddingTop = searchBarHeight + searchBarMargin * 2;
view.setPadding(0, /* left */
paddingTop, 0, /* right */
0);
}
Aggregations