Loading packages/SettingsLib/Tile/src/com/android/settingslib/drawer/ActivityTile.java +2 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.settingslib.drawer; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ComponentInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; Loading @@ -33,7 +34,7 @@ import java.util.Objects; public class ActivityTile extends Tile { private static final String TAG = "ActivityTile"; public ActivityTile(ComponentInfo info, String category) { public ActivityTile(ActivityInfo info, String category) { super(info, category); setMetaData(info.metaData); } Loading packages/SettingsLib/Tile/src/com/android/settingslib/drawer/MasterSwitchController.java 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settingslib.drawer; import android.os.Bundle; /** * A controller that manages event for master switch. */ public abstract class MasterSwitchController extends SwitchController { @Override protected final MetaData getMetaData() { throw new UnsupportedOperationException(); } @Override final Bundle getBundle() { throw new UnsupportedOperationException(); } } packages/SettingsLib/Tile/src/com/android/settingslib/drawer/ProviderTile.java +2 −2 Original line number Diff line number Diff line Loading @@ -42,10 +42,10 @@ public class ProviderTile extends Tile { private String mAuthority; private String mKey; public ProviderTile(ComponentInfo info, String category, Bundle metaData) { public ProviderTile(ProviderInfo info, String category, Bundle metaData) { super(info, category); setMetaData(metaData); mAuthority = ((ProviderInfo) info).authority; mAuthority = info.authority; mKey = metaData.getString(META_DATA_PREFERENCE_KEYHINT); } Loading packages/SettingsLib/Tile/src/com/android/settingslib/drawer/SwitchController.java +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public abstract class SwitchController { Bundle getBundle() { final MetaData metaData = getMetaData(); if (metaData == null) { throw new IllegalArgumentException("Should not return null in getMetaData()"); throw new NullPointerException("Should not return null in getMetaData()"); } final Bundle bundle = metaData.build(); Loading packages/SettingsLib/Tile/src/com/android/settingslib/drawer/SwitchesProvider.java +9 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public abstract class SwitchesProvider extends ContentProvider { private String mAuthority; private final Map<String, SwitchController> mControllerMap = new LinkedHashMap<>(); private final List<Bundle> mSwitchList = new ArrayList<>(); private final List<Bundle> mSwitchDataList = new ArrayList<>(); /** * Get a list of {@link SwitchController} for this provider. Loading Loading @@ -88,7 +88,9 @@ public abstract class SwitchesProvider extends ContentProvider { controller.setAuthority(mAuthority); mControllerMap.put(key, controller); mSwitchList.add(controller.getBundle()); if (!(controller instanceof MasterSwitchController)) { mSwitchDataList.add(controller.getBundle()); } }); return true; } Loading @@ -101,7 +103,7 @@ public abstract class SwitchesProvider extends ContentProvider { : null; if (TextUtils.isEmpty(key)) { if (METHOD_GET_SWITCH_DATA.equals(method)) { bundle.putParcelableList(EXTRA_SWITCH_DATA, mSwitchList); bundle.putParcelableList(EXTRA_SWITCH_DATA, mSwitchDataList); return bundle; } return null; Loading @@ -114,7 +116,10 @@ public abstract class SwitchesProvider extends ContentProvider { switch (method) { case METHOD_GET_SWITCH_DATA: if (!(controller instanceof MasterSwitchController)) { return controller.getBundle(); } break; case METHOD_GET_PROVIDER_ICON: if (controller instanceof ProviderIcon) { return ((ProviderIcon) controller).getProviderIcon(); Loading Loading
packages/SettingsLib/Tile/src/com/android/settingslib/drawer/ActivityTile.java +2 −1 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.settingslib.drawer; import android.content.Context; import android.content.Intent; import android.content.pm.ActivityInfo; import android.content.pm.ComponentInfo; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; Loading @@ -33,7 +34,7 @@ import java.util.Objects; public class ActivityTile extends Tile { private static final String TAG = "ActivityTile"; public ActivityTile(ComponentInfo info, String category) { public ActivityTile(ActivityInfo info, String category) { super(info, category); setMetaData(info.metaData); } Loading
packages/SettingsLib/Tile/src/com/android/settingslib/drawer/MasterSwitchController.java 0 → 100644 +35 −0 Original line number Diff line number Diff line /* * Copyright (C) 2019 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.settingslib.drawer; import android.os.Bundle; /** * A controller that manages event for master switch. */ public abstract class MasterSwitchController extends SwitchController { @Override protected final MetaData getMetaData() { throw new UnsupportedOperationException(); } @Override final Bundle getBundle() { throw new UnsupportedOperationException(); } }
packages/SettingsLib/Tile/src/com/android/settingslib/drawer/ProviderTile.java +2 −2 Original line number Diff line number Diff line Loading @@ -42,10 +42,10 @@ public class ProviderTile extends Tile { private String mAuthority; private String mKey; public ProviderTile(ComponentInfo info, String category, Bundle metaData) { public ProviderTile(ProviderInfo info, String category, Bundle metaData) { super(info, category); setMetaData(metaData); mAuthority = ((ProviderInfo) info).authority; mAuthority = info.authority; mKey = metaData.getString(META_DATA_PREFERENCE_KEYHINT); } Loading
packages/SettingsLib/Tile/src/com/android/settingslib/drawer/SwitchController.java +1 −1 Original line number Diff line number Diff line Loading @@ -108,7 +108,7 @@ public abstract class SwitchController { Bundle getBundle() { final MetaData metaData = getMetaData(); if (metaData == null) { throw new IllegalArgumentException("Should not return null in getMetaData()"); throw new NullPointerException("Should not return null in getMetaData()"); } final Bundle bundle = metaData.build(); Loading
packages/SettingsLib/Tile/src/com/android/settingslib/drawer/SwitchesProvider.java +9 −4 Original line number Diff line number Diff line Loading @@ -55,7 +55,7 @@ public abstract class SwitchesProvider extends ContentProvider { private String mAuthority; private final Map<String, SwitchController> mControllerMap = new LinkedHashMap<>(); private final List<Bundle> mSwitchList = new ArrayList<>(); private final List<Bundle> mSwitchDataList = new ArrayList<>(); /** * Get a list of {@link SwitchController} for this provider. Loading Loading @@ -88,7 +88,9 @@ public abstract class SwitchesProvider extends ContentProvider { controller.setAuthority(mAuthority); mControllerMap.put(key, controller); mSwitchList.add(controller.getBundle()); if (!(controller instanceof MasterSwitchController)) { mSwitchDataList.add(controller.getBundle()); } }); return true; } Loading @@ -101,7 +103,7 @@ public abstract class SwitchesProvider extends ContentProvider { : null; if (TextUtils.isEmpty(key)) { if (METHOD_GET_SWITCH_DATA.equals(method)) { bundle.putParcelableList(EXTRA_SWITCH_DATA, mSwitchList); bundle.putParcelableList(EXTRA_SWITCH_DATA, mSwitchDataList); return bundle; } return null; Loading @@ -114,7 +116,10 @@ public abstract class SwitchesProvider extends ContentProvider { switch (method) { case METHOD_GET_SWITCH_DATA: if (!(controller instanceof MasterSwitchController)) { return controller.getBundle(); } break; case METHOD_GET_PROVIDER_ICON: if (controller instanceof ProviderIcon) { return ((ProviderIcon) controller).getProviderIcon(); Loading