Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactored OOM handler to use the new key-value store #804

Merged
merged 3 commits into from
Sep 16, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 18 additions & 0 deletions Bugsnag.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -764,6 +764,13 @@
CBAA6ABB250BA70E00713376 /* BugsnagKVStore.h in Headers */ = {isa = PBXBuildFile; fileRef = CBAA6AB3250BA00500713376 /* BugsnagKVStore.h */; };
CBAA6ABC250BA70E00713376 /* BugsnagKVStore.h in Headers */ = {isa = PBXBuildFile; fileRef = CBAA6AB3250BA00500713376 /* BugsnagKVStore.h */; };
CBAA6ABD250BA70F00713376 /* BugsnagKVStore.h in Headers */ = {isa = PBXBuildFile; fileRef = CBAA6AB3250BA00500713376 /* BugsnagKVStore.h */; };
CBAB4DD52510D2460092CBAA /* BugsnagKVStoreObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CBAB4DD32510D2460092CBAA /* BugsnagKVStoreObjC.h */; };
CBAB4DD62510D2460092CBAA /* BugsnagKVStoreObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CBAB4DD32510D2460092CBAA /* BugsnagKVStoreObjC.h */; };
CBAB4DD72510D2460092CBAA /* BugsnagKVStoreObjC.h in Headers */ = {isa = PBXBuildFile; fileRef = CBAB4DD32510D2460092CBAA /* BugsnagKVStoreObjC.h */; };
CBAB4DD82510D2460092CBAA /* BugsnagKVStoreObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = CBAB4DD42510D2460092CBAA /* BugsnagKVStoreObjC.m */; };
CBAB4DD92510D2460092CBAA /* BugsnagKVStoreObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = CBAB4DD42510D2460092CBAA /* BugsnagKVStoreObjC.m */; };
CBAB4DDA2510D2460092CBAA /* BugsnagKVStoreObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = CBAB4DD42510D2460092CBAA /* BugsnagKVStoreObjC.m */; };
CBAB4DDB2510D2460092CBAA /* BugsnagKVStoreObjC.m in Sources */ = {isa = PBXBuildFile; fileRef = CBAB4DD42510D2460092CBAA /* BugsnagKVStoreObjC.m */; };
CBCF77A325010648004AF22A /* BSGJSONSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = CBCF77A125010648004AF22A /* BSGJSONSerialization.h */; };
CBCF77A425010648004AF22A /* BSGJSONSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = CBCF77A125010648004AF22A /* BSGJSONSerialization.h */; };
CBCF77A525010648004AF22A /* BSGJSONSerialization.h in Headers */ = {isa = PBXBuildFile; fileRef = CBCF77A125010648004AF22A /* BSGJSONSerialization.h */; };
Expand Down Expand Up @@ -1291,6 +1298,8 @@
CBAA6AB3250BA00500713376 /* BugsnagKVStore.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BugsnagKVStore.h; sourceTree = "<group>"; };
CBAA6AB4250BA01D00713376 /* BugsnagKVStore.c */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.c; path = BugsnagKVStore.c; sourceTree = "<group>"; };
CBAA6AB9250BA6B100713376 /* BugsnagKVStoreTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BugsnagKVStoreTest.m; sourceTree = "<group>"; };
CBAB4DD32510D2460092CBAA /* BugsnagKVStoreObjC.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BugsnagKVStoreObjC.h; sourceTree = "<group>"; };
CBAB4DD42510D2460092CBAA /* BugsnagKVStoreObjC.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BugsnagKVStoreObjC.m; sourceTree = "<group>"; };
CBCF77A125010648004AF22A /* BSGJSONSerialization.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = BSGJSONSerialization.h; sourceTree = "<group>"; };
CBCF77A225010648004AF22A /* BSGJSONSerialization.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BSGJSONSerialization.m; sourceTree = "<group>"; };
CBCF77AA250142E0004AF22A /* BSGJSONSerializerTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = BSGJSONSerializerTest.m; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1739,6 +1748,8 @@
008968132486DA5600DC48C2 /* BugsnagKeys.m */,
CBAA6AB4250BA01D00713376 /* BugsnagKVStore.c */,
CBAA6AB3250BA00500713376 /* BugsnagKVStore.h */,
CBAB4DD32510D2460092CBAA /* BugsnagKVStoreObjC.h */,
CBAB4DD42510D2460092CBAA /* BugsnagKVStoreObjC.m */,
008968142486DA5600DC48C2 /* BugsnagLogger.h */,
008968122486DA5600DC48C2 /* BugsnagPlatformConditional.h */,
);
Expand Down Expand Up @@ -1905,6 +1916,7 @@
008967F72486DA4500DC48C2 /* BugsnagApiClient.h in Headers */,
008969CC2486DAD100DC48C2 /* BSG_KSMach.h in Headers */,
CB10E544250BAD6100AF5824 /* BSGCachesDirectory.h in Headers */,
CBAB4DD52510D2460092CBAA /* BugsnagKVStoreObjC.h in Headers */,
008968282486DA5600DC48C2 /* BugsnagKeys.h in Headers */,
008969BD2486DAD100DC48C2 /* BSG_KSMachHeaders.h in Headers */,
008968DE2486DAA700DC48C2 /* BugsnagPluginClient.h in Headers */,
Expand Down Expand Up @@ -2004,6 +2016,7 @@
008967F82486DA4500DC48C2 /* BugsnagApiClient.h in Headers */,
008969CD2486DAD100DC48C2 /* BSG_KSMach.h in Headers */,
CB10E545250BAD6100AF5824 /* BSGCachesDirectory.h in Headers */,
CBAB4DD62510D2460092CBAA /* BugsnagKVStoreObjC.h in Headers */,
008968292486DA5600DC48C2 /* BugsnagKeys.h in Headers */,
008969BE2486DAD100DC48C2 /* BSG_KSMachHeaders.h in Headers */,
008968DF2486DAA700DC48C2 /* BugsnagPluginClient.h in Headers */,
Expand Down Expand Up @@ -2103,6 +2116,7 @@
008967F92486DA4500DC48C2 /* BugsnagApiClient.h in Headers */,
008969CE2486DAD100DC48C2 /* BSG_KSMach.h in Headers */,
CB10E546250BAD6100AF5824 /* BSGCachesDirectory.h in Headers */,
CBAB4DD72510D2460092CBAA /* BugsnagKVStoreObjC.h in Headers */,
0089682A2486DA5600DC48C2 /* BugsnagKeys.h in Headers */,
008969BF2486DAD100DC48C2 /* BSG_KSMachHeaders.h in Headers */,
008968E02486DAA700DC48C2 /* BugsnagPluginClient.h in Headers */,
Expand Down Expand Up @@ -2472,6 +2486,7 @@
00896A172486DAD100DC48C2 /* BSG_KSCrashSentry_CPPException.mm in Sources */,
008969CF2486DAD100DC48C2 /* BSG_KSCrashState.m in Sources */,
008968C32486DA9600DC48C2 /* BugsnagUser.m in Sources */,
CBAB4DD82510D2460092CBAA /* BugsnagKVStoreObjC.m in Sources */,
008968A72486DA9600DC48C2 /* BugsnagSession.m in Sources */,
00AD1F052486A17900A27979 /* RegisterErrorData.m in Sources */,
0089683A2486DA6C00DC48C2 /* BugsnagMetadata.m in Sources */,
Expand Down Expand Up @@ -2632,6 +2647,7 @@
00896A182486DAD100DC48C2 /* BSG_KSCrashSentry_CPPException.mm in Sources */,
008969D02486DAD100DC48C2 /* BSG_KSCrashState.m in Sources */,
008968C42486DA9600DC48C2 /* BugsnagUser.m in Sources */,
CBAB4DD92510D2460092CBAA /* BugsnagKVStoreObjC.m in Sources */,
008968A82486DA9600DC48C2 /* BugsnagSession.m in Sources */,
00AD1F062486A17900A27979 /* RegisterErrorData.m in Sources */,
0089683B2486DA6C00DC48C2 /* BugsnagMetadata.m in Sources */,
Expand Down Expand Up @@ -2790,6 +2806,7 @@
00896A192486DAD100DC48C2 /* BSG_KSCrashSentry_CPPException.mm in Sources */,
008969D12486DAD100DC48C2 /* BSG_KSCrashState.m in Sources */,
008968C52486DA9600DC48C2 /* BugsnagUser.m in Sources */,
CBAB4DDA2510D2460092CBAA /* BugsnagKVStoreObjC.m in Sources */,
008968A92486DA9600DC48C2 /* BugsnagSession.m in Sources */,
00AD1F072486A17900A27979 /* RegisterErrorData.m in Sources */,
0089683C2486DA6C00DC48C2 /* BugsnagMetadata.m in Sources */,
Expand Down Expand Up @@ -2937,6 +2954,7 @@
008968AA2486DA9600DC48C2 /* BugsnagSession.m in Sources */,
008968982486DA9600DC48C2 /* BugsnagHandledState.m in Sources */,
008968B52486DA9600DC48C2 /* BugsnagDeviceWithState.m in Sources */,
CBAB4DDB2510D2460092CBAA /* BugsnagKVStoreObjC.m in Sources */,
00AD1F2A2486A17900A27979 /* BugsnagCrashSentry.m in Sources */,
008968052486DA4500DC48C2 /* BSGConnectivity.m in Sources */,
00AD1F162486A17900A27979 /* BugsnagErrorReportSink.m in Sources */,
Expand Down
15 changes: 3 additions & 12 deletions Bugsnag/BSGOutOfMemoryWatchdog.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
@interface BSGOutOfMemoryWatchdog : NSObject

@property(nonatomic, strong, readonly) NSDictionary *lastBootCachedFileInfo;
@property(nonatomic, readonly) BOOL didOOMLastLaunch;

/**
* Create a new watchdog using the sentinel path to store app/device state
Expand All @@ -16,18 +17,8 @@
NS_DESIGNATED_INITIALIZER;

/**
* @return YES if the app was killed to end the previous app launch
* Begin monitoring for lifecycle events
*/
- (BOOL)didOOMLastLaunch;

/**
* Begin monitoring for lifecycle events and report the OOM from the last launch (if any)
*/
- (void)enable;

/**
* Stop monitoring for lifecycle events
*/
- (void)disable;
- (void)start;

@end
147 changes: 100 additions & 47 deletions Bugsnag/BSGOutOfMemoryWatchdog.m
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,32 @@
#import "BSGJSONSerialization.h"
#import "BugsnagKeys.h"
#import "BugsnagCollections.h"
#import "BugsnagKVStoreObjC.h"

#define KV_KEY_IS_MONITORING_OOM @"oom-isMonitoringOOM"
#define KV_KEY_IS_ACTIVE @"oom-isActive"
#define KV_KEY_IS_IN_FOREGROUND @"oom-isInForeground"
#define KV_KEY_LAST_LOW_MEMORY_WARNING @"oom-lastLowMemoryWarning"
#define KV_KEY_APP_VERSION @"oom-appVersion"
#define KV_KEY_BUNDLE_VERSION @"oom-bundleVersion"

#define APP_KEY_IS_MONITORING_OOM @"isMonitoringOOM"
#define APP_KEY_IS_IN_FOREGROUND @"inForeground"
#define APP_KEY_IS_ACTIVE @"isActive"
#define DEVICE_KEY_LAST_LOW_MEMORY_WARNING @"lowMemory"
#define APP_KEY_VERSION @"version"
#define APP_KEY_BUNDLE_VERSION @"bundleVersion"

@interface BSGOutOfMemoryWatchdog ()
@property(nonatomic, getter=isWatching) BOOL watching;
@property(nonatomic, strong) NSString *sentinelFilePath;
@property(nonatomic, getter=didOOMLastLaunch) BOOL oomLastLaunch;
@property(nonatomic, strong, readwrite) NSMutableDictionary *cachedFileInfo;
@property(nonatomic, strong, readwrite) NSDictionary *lastBootCachedFileInfo;
@property(nonatomic) NSString *codeBundleId;
@property(nonatomic) BugsnagKVStore *kvStore;
@property(nonatomic) NSDictionary *previousKeyValues;

- (void)shutdown;
@end

@implementation BSGOutOfMemoryWatchdog
Expand All @@ -44,23 +62,75 @@ - (instancetype)initWithSentinelPath:(NSString *)sentinelFilePath
}
if (self = [super init]) {
_sentinelFilePath = sentinelFilePath;

#ifdef BSGOOMAvailable
_oomLastLaunch = [self computeDidOOMLastLaunchWithConfig:config];
_kvStore = [BugsnagKVStore new];

_previousKeyValues = getKeyValues(_kvStore);
_lastBootCachedFileInfo = [self readSentinelFile];
_cachedFileInfo = [self generateCacheInfoWithConfig:config];

[_kvStore setBoolean:false forKey:KV_KEY_IS_MONITORING_OOM];
[_kvStore setString:@"" forKey:KV_KEY_LAST_LOW_MEMORY_WARNING];
NSDictionary *systemInfo = [BSG_KSSystemInfo systemInfo];
[_kvStore setString:systemInfo[@BSG_KSSystemField_BundleShortVersion] forKey:KV_KEY_APP_VERSION];
[_kvStore setString:systemInfo[@BSG_KSSystemField_BundleVersion] forKey:KV_KEY_BUNDLE_VERSION];

_didOOMLastLaunch = calculateDidOOM(_kvStore, _previousKeyValues);
#endif
}
return self;
}

- (void)enable {
static NSDictionary *getKeyValues(BugsnagKVStore *store) {
NSMutableDictionary *dict = [NSMutableDictionary new];
dict[APP_KEY_IS_MONITORING_OOM] = [store NSBooleanForKey:KV_KEY_IS_MONITORING_OOM defaultValue:false];
dict[APP_KEY_IS_ACTIVE] = [store NSBooleanForKey:KV_KEY_IS_ACTIVE defaultValue:false];
dict[APP_KEY_IS_IN_FOREGROUND] = [store NSBooleanForKey:KV_KEY_IS_IN_FOREGROUND defaultValue:false];
dict[APP_KEY_VERSION] = [store stringForKey:KV_KEY_APP_VERSION defaultValue:@""];
dict[APP_KEY_BUNDLE_VERSION] = [store stringForKey:KV_KEY_BUNDLE_VERSION defaultValue:@""];
dict[DEVICE_KEY_LAST_LOW_MEMORY_WARNING] = [store stringForKey:KV_KEY_LAST_LOW_MEMORY_WARNING defaultValue:@""];
return dict;
}

BOOL calculateDidOOM(BugsnagKVStore *store, NSDictionary *previousValues) {
BOOL wasMonitoring = [[previousValues valueForKey:APP_KEY_IS_MONITORING_OOM] boolValue];
if(!wasMonitoring) {
return NO;
}

BOOL wasActive = [[previousValues valueForKey:APP_KEY_IS_ACTIVE] boolValue];
BOOL wasInForeground = [[previousValues valueForKey:APP_KEY_IS_IN_FOREGROUND] boolValue];
if(!(wasActive && wasInForeground)) {
return NO;
}

NSString *oldAppVersion = [previousValues valueForKey:APP_KEY_VERSION];
NSString *newAppVersion = [store stringForKey:KV_KEY_APP_VERSION defaultValue:@""];
NSString *oldBundleVersion = [previousValues valueForKey:APP_KEY_BUNDLE_VERSION];
NSString *newBundleVersion = [store stringForKey:KV_KEY_BUNDLE_VERSION defaultValue:@""];

if(![oldAppVersion isEqualToString:newAppVersion] || ![oldBundleVersion isEqualToString:newBundleVersion]) {
return NO;
}

return YES;
}

- (void)start {
#if BSGOOMAvailable
if ([self isWatching]) {
return;
}
UIApplicationState state = [BSG_KSSystemInfo currentAppState];
[self.kvStore setBoolean:true forKey:KV_KEY_IS_MONITORING_OOM];
[self.kvStore setBoolean:[BSG_KSSystemInfo isInForeground:state] forKey:KV_KEY_IS_IN_FOREGROUND];
[self.kvStore setBoolean:state == UIApplicationStateActive forKey:KV_KEY_IS_ACTIVE];

[self writeSentinelFile];
NSNotificationCenter *center = [NSNotificationCenter defaultCenter];
[center addObserver:self
selector:@selector(disable:)
selector:@selector(shutdown:)
name:UIApplicationWillTerminateNotification
object:nil];
[center addObserver:self
Expand Down Expand Up @@ -96,11 +166,11 @@ - (void)enable {
#endif
}

- (void)disable:(NSNotification *)note {
[self disable];
- (void)shutdown:(NSNotification *)note {
[self shutdown];
}

- (void)disable {
- (void)shutdown {
if (![self isWatching]) {
// Avoid unsubscribing from KVO when not observing
// From the docs:
Expand All @@ -110,6 +180,7 @@ - (void)disable {
// > corresponding call to `addObserver:forKeyPath:options:context:`
return;
}
[self.kvStore setBoolean:false forKey:KV_KEY_IS_MONITORING_OOM];
self.watching = NO;
[self deleteSentinelFile];
[[NSNotificationCenter defaultCenter] removeObserver:self];
Expand All @@ -132,28 +203,33 @@ - (void)observeValueForKeyPath:(NSString *)keyPath
}

- (void)handleTransitionToActive:(NSNotification *)note {
self.cachedFileInfo[BSGKeyApp][@"isActive"] = @YES;
[self.kvStore setBoolean:true forKey:KV_KEY_IS_ACTIVE];
self.cachedFileInfo[BSGKeyApp][APP_KEY_IS_ACTIVE] = @YES;
[self writeSentinelFile];
}

- (void)handleTransitionToInactive:(NSNotification *)note {
self.cachedFileInfo[BSGKeyApp][@"isActive"] = @NO;
[self.kvStore setBoolean:false forKey:KV_KEY_IS_ACTIVE];
self.cachedFileInfo[BSGKeyApp][APP_KEY_IS_ACTIVE] = @NO;
[self writeSentinelFile];
}

- (void)handleTransitionToForeground:(NSNotification *)note {
self.cachedFileInfo[BSGKeyApp][@"inForeground"] = @YES;
[self.kvStore setBoolean:true forKey:KV_KEY_IS_IN_FOREGROUND];
self.cachedFileInfo[BSGKeyApp][APP_KEY_IS_IN_FOREGROUND] = @YES;
[self writeSentinelFile];
}

- (void)handleTransitionToBackground:(NSNotification *)note {
self.cachedFileInfo[BSGKeyApp][@"inForeground"] = @NO;
[self.kvStore setBoolean:false forKey:KV_KEY_IS_IN_FOREGROUND];
self.cachedFileInfo[BSGKeyApp][APP_KEY_IS_IN_FOREGROUND] = @NO;
[self writeSentinelFile];
}

- (void)handleLowMemoryChange:(NSNotification *)note {
self.cachedFileInfo[BSGKeyDevice][@"lowMemory"] = [BSG_RFC3339DateTool
stringFromDate:[NSDate date]];
NSString *date = [BSG_RFC3339DateTool stringFromDate:[NSDate date]];
[self.kvStore setString:date forKey:KV_KEY_LAST_LOW_MEMORY_WARNING];
self.cachedFileInfo[BSGKeyDevice][DEVICE_KEY_LAST_LOW_MEMORY_WARNING] = date;
[self writeSentinelFile];
}

Expand All @@ -177,39 +253,6 @@ - (void)setCodeBundleId:(NSString *)codeBundleId {
}
}


- (BOOL)computeDidOOMLastLaunchWithConfig:(BugsnagConfiguration *)config {
if ([[NSFileManager defaultManager] fileExistsAtPath:self.sentinelFilePath]) {
NSDictionary *lastBootInfo = [self readSentinelFile];
if (lastBootInfo != nil) {
self.lastBootCachedFileInfo = lastBootInfo;
NSString *lastBootBundleVersion =
[lastBootInfo valueForKeyPath:@"app.bundleVersion"];
NSString *lastBootAppVersion =
[lastBootInfo valueForKeyPath:@"app.version"];
NSString *lastBootOSVersion =
[lastBootInfo valueForKeyPath:@"device.osBuild"];
BOOL lastBootInForeground =
[[lastBootInfo valueForKeyPath:@"app.inForeground"] boolValue];
BOOL lastBootWasActive =
[[lastBootInfo valueForKeyPath:@"app.isActive"] boolValue];
NSString *osVersion = [BSG_KSSystemInfo osBuildVersion];
NSDictionary *appInfo = [[NSBundle mainBundle] infoDictionary];
NSString *bundleVersion =
[appInfo valueForKey:@BSG_KSSystemField_BundleVersion];
NSString *appVersion =
[appInfo valueForKey:@BSG_KSSystemField_BundleShortVersion];
BOOL sameVersions = [lastBootOSVersion isEqualToString:osVersion] &&
[lastBootBundleVersion isEqualToString:bundleVersion] &&
[lastBootAppVersion isEqualToString:appVersion];
BOOL shouldReport = (lastBootInForeground && lastBootWasActive);
[self deleteSentinelFile];
return sameVersions && shouldReport;
}
}
return NO;
}

- (void)deleteSentinelFile {
NSError *error = nil;
[[NSFileManager defaultManager] removeItemAtPath:self.sentinelFilePath
Expand All @@ -221,6 +264,10 @@ - (void)deleteSentinelFile {
}

- (NSDictionary *)readSentinelFile {
if (![[NSFileManager defaultManager] fileExistsAtPath:self.sentinelFilePath]) {
return @{};
}

NSError *error = nil;
NSData *data = [NSData dataWithContentsOfFile:self.sentinelFilePath options:0 error:&error];
if (error) {
Expand All @@ -232,10 +279,16 @@ - (NSDictionary *)readSentinelFile {
bsg_log_err(@"Failed to read oom watchdog file: %@", error);
return nil;
}

// Override JSON data with KV store data
contents[BSGKeyApp][APP_KEY_IS_MONITORING_OOM] = [self.kvStore NSBooleanForKey:KV_KEY_IS_MONITORING_OOM defaultValue:false];
contents[BSGKeyApp][APP_KEY_IS_ACTIVE] = [self.kvStore NSBooleanForKey:KV_KEY_IS_ACTIVE defaultValue:false];
contents[BSGKeyApp][APP_KEY_IS_IN_FOREGROUND] = [self.kvStore NSBooleanForKey:KV_KEY_IS_IN_FOREGROUND defaultValue:false];
contents[BSGKeyDevice][DEVICE_KEY_LAST_LOW_MEMORY_WARNING] = [self.kvStore stringForKey:KV_KEY_LAST_LOW_MEMORY_WARNING defaultValue:@""];

return contents;
}


- (void)writeSentinelFile {
NSError *error = nil;
if (![BSGJSONSerialization isValidJSONObject:self.cachedFileInfo]) {
Expand Down
2 changes: 1 addition & 1 deletion Bugsnag/Client/BugsnagClient.m
Original file line number Diff line number Diff line change
Expand Up @@ -617,7 +617,7 @@ - (void)start {
BOOL notInAppExtension = ![BSG_KSSystemInfo isRunningInAppExtension];

if (configuredToReportOOMs && noDebuggerEnabled && notInAppExtension) {
[self.oomWatchdog enable];
[self.oomWatchdog start];
}

[self.sessionTracker startNewSessionIfAutoCaptureEnabled];
Expand Down
Loading