Device Activity Report only for Selected Apps

I want to display device activity reports for particular selected apps. for getting a daily basis app uses time. Now, what is happening? there are 10 apps selected from the family activity picker but some apps are displayed in the list. I need all 10 apps or more that I will choose from the family activity picker. The bellow code is used for fetching reports.

var body: some View {

    VStack {
        DeviceActivityReport(context, filter: filter)
     }
}

bellow code is used for the filter

@State public var filter = DeviceActivityFilter()

init(selectedApps: Set<ApplicationToken>, selectedCategories: Set<ActivityCategoryToken>, selectedWebDomains: Set<WebDomainToken>) {
    
    self.selectedApps = selectedApps
    self.selectedCategories = selectedCategories
    self.selectedWebDomains = selectedWebDomains
    self.filter = DeviceActivityFilter(
        segment: .daily(
            during: Calendar.current.dateInterval(
                of: .weekOfYear, for: .now
            )!
        ),
        users: .all,
        devices: .init([.iPhone]),
        applications: selectedApps,
        categories: selectedCategories,
        webDomains: selectedWebDomains
    )
}

You can see we selected 3 apps from family activity picker but we getting 2 apps from DeviceActivityReport extension

following code is for device activity report extension

let context: DeviceActivityReport.Context = .totalActivity

// Define the custom configuration and the resulting view for this report.
let content: (ActivityReport) -> TotalActivityView

   func makeConfiguration(representing data: DeviceActivityResults<DeviceActivityData>) async -> ActivityReport {
    // Reformat the data into a configuration that can be used to create
    // the report's view.
    var res = ""
    var list: [AppDeviceActivity] = []
    let totalActivityDuration = await data.flatMap { $0.activitySegments }.reduce(0, {
        $0 + $1.totalActivityDuration
    })
    for await d in data {
        res += d.user.appleID!.debugDescription
        res += d.lastUpdatedDate.description
        
        for await a in d.activitySegments{
            res += a.totalActivityDuration.formatted()
            for await c in a.categories {
                for await ap in c.applications {
                    if let apptoken = ap.application.token {
                        let appName = (ap.application.localizedDisplayName ?? "nil")
                        let bundle = (ap.application.bundleIdentifier ?? "nil")
                        let duration = ap.totalActivityDuration
                        let numberOfPickups = ap.numberOfPickups
                    let app = AppDeviceActivity(appToken: apptoken, id: bundle, displayName: appName, duration: duration, numberOfPickups: numberOfPickups)
                        list.append(app)
                    }
                }
            }
        }
    }
    

      
    return ActivityReport(totalDuration: totalActivityDuration, apps: list)
}

Our engineering teams need to investigate this issue, as resolution may involve changes to Apple's software. I'd greatly appreciate it if you could open a bug report, include a sample project and sysdiagnose, and post the FB number here once you do. Bug Reporting: How and Why? has tips on creating your bug report.

Could you please mention how did you get the locked data like the app name?

Device Activity Report only for Selected Apps
 
 
Q