Skip to content

Commit d972065

Browse files
committed
Updated code per comments
1 parent 5c4c4df commit d972065

File tree

3 files changed

+17
-7
lines changed

3 files changed

+17
-7
lines changed

examples/tv-app/android/App/platform-app/src/main/java/com/matter/tv/server/handlers/ApplicationLauncherManagerImpl.java

+9-5
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ private void registerSelf(Context context) {
8181
@Override
8282
public int[] getCatalogList() {
8383
Log.i(TAG, "Get Catalog List");
84-
return new int[] {65521, 8891, 3191};
84+
return new int[] {123, 456, 89010};
8585
}
8686

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

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

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

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

138-
} else if (matterAppEnabledIsInstalled && appIsInstalled) {
142+
} else if (matterEnabledAppdIsInstalled && appIsInstalled) {
139143
Log.i(TAG, "Launching the app");
140144
status = LauncherResponse.STATUS_SUCCESS;
141145

examples/tv-app/android/java/AppImpl.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -420,9 +420,10 @@ void ContentAppFactoryImpl::LogInstalledApps()
420420
{
421421
for (auto & contentApp : mContentApps)
422422
{
423-
ChipLogProgress(DeviceLayer, "Content app vid=%d pid=%d is on ep=%d",
423+
ChipLogProgress(DeviceLayer, "Content app vid=%d pid=%d id=%s is on ep=%d",
424424
contentApp->GetApplicationBasicDelegate()->HandleGetVendorId(),
425-
contentApp->GetApplicationBasicDelegate()->HandleGetProductId(), contentApp->GetEndpointId());
425+
contentApp->GetApplicationBasicDelegate()->HandleGetProductId(),
426+
contentApp->GetApplicationBasicDelegate()->GetCatalogVendorApp()->GetApplicationId(), contentApp->GetEndpointId());
426427
}
427428
}
428429

src/app/clusters/application-basic-server/application-basic-delegate.h

+5
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ class DLL_EXPORT CatalogVendorApp
5858
Platform::CopyString(applicationId, sizeof(applicationId), appId);
5959
}
6060

61+
const char * GetApplicationId()
62+
{
63+
return applicationId;
64+
}
65+
6166
static const int kApplicationIdSize = 32;
6267
char applicationId[kApplicationIdSize];
6368
uint16_t catalogVendorId;

0 commit comments

Comments
 (0)