Skip to content

Commit

Permalink
Updated code per comments
Browse files Browse the repository at this point in the history
  • Loading branch information
lazarkov committed Jul 2, 2024
1 parent 5c4c4df commit d972065
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private void registerSelf(Context context) {
@Override
public int[] getCatalogList() {
Log.i(TAG, "Get Catalog List");
return new int[] {65521, 8891, 3191};
return new int[] {123, 456, 89010};
}

@Override
Expand All @@ -93,8 +93,10 @@ public LauncherResponse launchApp(Application app, String data) {
int status = 0;
String responseData = "";

boolean matterAppEnabledIsInstalled =
// Installed Apps that have declared CSA product id & vendor id in their manifes
boolean matterEnabledAppdIsInstalled =
endpointsDataStore.getAllPersistedContentApps().containsKey(app.applicationId);
// Installed App
boolean appIsInstalled =
InstallationObserver.getInstalledPackages(packageManager).contains(app.applicationId);
boolean isAppInstalling =
Expand All @@ -106,7 +108,9 @@ public LauncherResponse launchApp(Application app, String data) {
lastReceivedInstallationStatus.get(app.applicationId),
InstallationObserver.InstallStatus.FAILED);

if (!matterAppEnabledIsInstalled && appIsInstalled) {
// This use-case can happen if app is installed
// but it does not support Matter
if (!matterEnabledAppdIsInstalled && appIsInstalled) {
Log.i(
TAG,
"Matter enabled app is not installed, but app is installed. Launching app's install page");
Expand All @@ -117,7 +121,7 @@ public LauncherResponse launchApp(Application app, String data) {
// Add code to launch App Install Page
//

} else if (!matterAppEnabledIsInstalled && !appIsInstalled) {
} else if (!matterEnabledAppdIsInstalled && !appIsInstalled) {
Log.i(
TAG,
"Matter enabled app is not installed and app is not installed. Launching app's install page");
Expand All @@ -135,7 +139,7 @@ public LauncherResponse launchApp(Application app, String data) {
// Add code to launch App Install Page
//

} else if (matterAppEnabledIsInstalled && appIsInstalled) {
} else if (matterEnabledAppdIsInstalled && appIsInstalled) {
Log.i(TAG, "Launching the app");
status = LauncherResponse.STATUS_SUCCESS;

Expand Down
5 changes: 3 additions & 2 deletions examples/tv-app/android/java/AppImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -420,9 +420,10 @@ void ContentAppFactoryImpl::LogInstalledApps()
{
for (auto & contentApp : mContentApps)
{
ChipLogProgress(DeviceLayer, "Content app vid=%d pid=%d is on ep=%d",
ChipLogProgress(DeviceLayer, "Content app vid=%d pid=%d id=%s is on ep=%d",
contentApp->GetApplicationBasicDelegate()->HandleGetVendorId(),
contentApp->GetApplicationBasicDelegate()->HandleGetProductId(), contentApp->GetEndpointId());
contentApp->GetApplicationBasicDelegate()->HandleGetProductId(),
contentApp->GetApplicationBasicDelegate()->GetCatalogVendorApp()->GetApplicationId(), contentApp->GetEndpointId());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ class DLL_EXPORT CatalogVendorApp
Platform::CopyString(applicationId, sizeof(applicationId), appId);
}

const char * GetApplicationId()
{
return applicationId;
}

static const int kApplicationIdSize = 32;
char applicationId[kApplicationIdSize];
uint16_t catalogVendorId;
Expand Down

0 comments on commit d972065

Please sign in to comment.